Skip to content

Commit

Permalink
More retries
Browse files Browse the repository at this point in the history
  • Loading branch information
Equinox- committed Sep 22, 2024
1 parent 372e9f5 commit 86af530
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions SchemaBuilder/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,19 @@ await RunWithRetry(steam => steam.InstallModAsync(info.SteamGameAppId, details.p

private async Task<T> RunWithRetry<T>(Func<SteamDownloader, Task<T>> action)
{
try
{
return await action(_steamInternal);
}
catch
var attempt = 0;
while (true)
{
await Task.Delay(TimeSpan.FromSeconds(10));
return await action(_steamInternal);
try
{
return await action(_steamInternal);
}
catch
{
if (attempt >= 5) throw;
await Task.Delay(TimeSpan.FromSeconds(10 * Math.Pow(2, attempt)));
attempt++;
}
}
}

Expand Down

0 comments on commit 86af530

Please sign in to comment.