handle cancellation

This commit is contained in:
Kukks
2023-04-06 14:11:07 +02:00
parent 5ffd21d45a
commit 2a0165b5eb
3 changed files with 11 additions and 4 deletions

View File

@@ -43,7 +43,6 @@ public class Zapper : IHostedService
{
while (!cancellationToken.IsCancellationRequested)
{
if (_pendingZapEvents.Any())
{
_logger.LogInformation($"Attempting to send {_pendingZapEvents.Count} zap receipts");
@@ -94,7 +93,15 @@ public class Zapper : IHostedService
}
else
{
await Task.Delay(100, waitingToken.Token);
try
{
await Task.Delay(100, waitingToken.Token);
}
catch (TaskCanceledException e)
{
break;
}
}
}
}