Better logging reconnect on disconnect?
This commit is contained in:
parent
703dc7b3b2
commit
8ea62fd807
@ -66,11 +66,18 @@ namespace NadekoBot
|
|||||||
|
|
||||||
_log.Info($"Shard #{i} initialized.");
|
_log.Info($"Shard #{i} initialized.");
|
||||||
|
|
||||||
client.Disconnected += (ex) =>
|
var j = i;
|
||||||
|
client.Disconnected += async (ex) =>
|
||||||
{
|
{
|
||||||
_log.Error("Shard #{0} disconnected", i);
|
try
|
||||||
_log.Error(ex);
|
{
|
||||||
return Task.CompletedTask;
|
_log.Error("Shard #{0} disconnected", j);
|
||||||
|
_log.Error(ex, ex?.Message ?? "No error");
|
||||||
|
|
||||||
|
try { await client.DisconnectAsync().ConfigureAwait(false); } catch { }
|
||||||
|
await client.ConnectAsync().ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user