Rss errors will now show error counter until deletion

This commit is contained in:
Kwoth
2022-06-15 13:18:00 +02:00
parent e9923a7691
commit 6c11d11645

View File

@@ -49,7 +49,7 @@ public class FeedsService : INService
private void ClearErrors(string url) private void ClearErrors(string url)
=> _errorCounters.Remove(url); => _errorCounters.Remove(url);
private async Task AddError(string url, List<int> ids) private async Task<uint> AddError(string url, List<int> ids)
{ {
try try
{ {
@@ -68,10 +68,13 @@ public class FeedsService : INService
// reset the error counter // reset the error counter
ClearErrors(url); ClearErrors(url);
} }
return newValue;
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex, "Error adding rss errors..."); Log.Error(ex, "Error adding rss errors...");
return 0;
} }
} }
@@ -181,12 +184,13 @@ public class FeedsService : INService
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Warning("An error occured while getting rss stream {RssFeed}" var errorCount = await AddError(rssUrl, kvp.Value.Select(x => x.Id).ToList());
Log.Warning("An error occured while getting rss stream ({ErrorCount} / 100) {RssFeed}"
+ "\n {Message}", + "\n {Message}",
errorCount,
rssUrl, rssUrl,
$"[{ex.GetType().Name}]: {ex.Message}"); $"[{ex.GetType().Name}]: {ex.Message}");
await AddError(rssUrl, kvp.Value.Select(x => x.Id).ToList());
} }
} }