Skip to content

Commit

Permalink
Remove retrying replay downloads.
Browse files Browse the repository at this point in the history
I'd much rather have the odd replay fail to download currently. It needs a robust system, not what I did here in 3 minutes.
  • Loading branch information
Simyon264 committed Oct 5, 2024
1 parent 75c3c84 commit d626ea9
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions ReplayBrowser/Services/ReplayParser/ReplayParserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public class ReplayParserService : IHostedService, IDisposable
/// In this case we wont just add it to the parsed replays, so it redownloads it every time.
/// </summary>
private const string YamlSerializerError = "Exception during deserialization";
/// <summary>
/// Holds the amount of retries for parsing a replay. If it fails 3 times, it will be added to the parsed replays.
/// </summary>
private Dictionary<string, int> _replayRetries = new();

public ReplayParserService(IConfiguration configuration, IServiceScopeFactory factory)
{
Expand Down Expand Up @@ -209,21 +205,7 @@ private async Task ConsumeQueue(CancellationToken token)
}
catch (Exception e)
{
if (!_replayRetries.TryGetValue(replay, out var count))
{
_replayRetries.Add(replay, 1);
count = 1;
}
_replayRetries[replay]++;
Log.Error(e, "Error while parsing {Replay}. Retry count: {Count}", replay, count);
if (count >= 3)
{
await AddParsedReplayToDb(replay);
Log.Error("Failed to parse " + replay + " after 3 retries.");
return;
}
if (e.Message.Contains(YamlSerializerError)) return;
Log.Error(e, "Error while parsing {Replay}", replay);
await AddParsedReplayToDb(replay);
return;
}
Expand Down

0 comments on commit d626ea9

Please sign in to comment.