Skip to content

Commit 8224282

Browse files
committed
added debugging lines
1 parent f81105a commit 8224282

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/CocApi.Cache/CocApi.Cache.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Authors>devhl</Authors>
77
<Product />
88
<Description>Caches response from the Clash of Clans API.</Description>
9-
<Version>2.11.13-debug.4</Version>
9+
<Version>2.11.13-debug.5</Version>
1010
<AssemblyVersion>2.0.0.0</AssemblyVersion>
1111
<FileVersion>2.0.0.0</FileVersion>
1212
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

src/CocApi.Cache/Services/WarService.cs

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Microsoft.Extensions.Options;
1212
using CocApi.Rest.Client;
1313
using CocApi.Cache.Services.Options;
14+
using System.Net.Mime;
1415

1516
namespace CocApi.Cache.Services;
1617

@@ -51,7 +52,7 @@ public WarService(
5152
Options = options;
5253
}
5354

54-
private int _min = 0;
55+
private int _min = int.MinValue;
5556

5657
protected override async Task ExecuteScheduledTaskAsync(CancellationToken cancellationToken)
5758
{
@@ -87,7 +88,7 @@ protected override async Task ExecuteScheduledTaskAsync(CancellationToken cancel
8788

8889
debug = "d";
8990

90-
_min = cachedWars.Min(c => c.Id);
91+
_min = cachedWars.Count > 0 ? cachedWars.Min(c => c.Id) : int.MinValue;
9192

9293
_id = cachedWars.Count == options.ConcurrentUpdates
9394
? cachedWars.Max(c => c.Id)
@@ -129,10 +130,13 @@ protected override async Task ExecuteScheduledTaskAsync(CancellationToken cancel
129130
{
130131
updatingWar.Add(cachedWar.Key);
131132
}
132-
catch (Exception)
133+
catch (Exception err)
133134
{
134135
erroredWarId = cachedWar.Id;
135-
throw;
136+
137+
Logger.LogError(err, "Could not handle war id {warId}", erroredWarId);
138+
139+
continue;
136140
}
137141

138142
debug = "k";

0 commit comments

Comments
 (0)