Fix tickCount incrementing more than once per tick

This commit is contained in:
Noi 2023-12-08 20:45:40 -08:00
parent 41def830c4
commit 85bb07ed96

View file

@ -57,11 +57,11 @@ class ShardBackgroundWorker : IDisposable {
if (Instance.DiscordClient.ConnectionState != ConnectionState.Connected) continue;
// Execute tasks sequentially
_tickCount++;
foreach (var service in _workers) {
CurrentExecutingService = service.GetType().Name;
try {
if (_workerCanceller.IsCancellationRequested) break;
_tickCount++;
await service.OnTick(_tickCount, _workerCanceller.Token);
} catch (Exception ex) when (ex is not
(TaskCanceledException or OperationCanceledException or ObjectDisposedException)) {