From 08fc1b12f73769f25f451db0d8d0f55c2efdaddd Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Tue, 24 Oct 2017 09:19:28 +0200 Subject: [PATCH] possible fix for shards being restarted when bot is starting up --- NadekoBot.Core/Services/ShardsCoordinator.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NadekoBot.Core/Services/ShardsCoordinator.cs b/NadekoBot.Core/Services/ShardsCoordinator.cs index 0b1160ef..04b12ad2 100644 --- a/NadekoBot.Core/Services/ShardsCoordinator.cs +++ b/NadekoBot.Core/Services/ShardsCoordinator.cs @@ -241,6 +241,7 @@ namespace NadekoBot.Core.Services await tsc.Task.ConfigureAwait(false); while (true) { + await Task.Delay(10000).ConfigureAwait(false); try { var db = _redis.GetDatabase(); @@ -252,12 +253,15 @@ namespace NadekoBot.Core.Services if (!statuses.Any()) { -#if !DEBUG +#if DEBUG for (var i = 0; i < _shardProcesses.Length; i++) { var p = _shardProcesses[i]; if (p == null || p.HasExited) + { + _log.Warn("Scheduling shard {0} for restart because it's process is stopped.", i); _shardStartQueue.Enqueue(i); + } } #endif } @@ -277,10 +281,6 @@ namespace NadekoBot.Core.Services } } catch (Exception ex) { _log.Error(ex); throw; } - finally - { - await Task.Delay(10000).ConfigureAwait(false); - } } });