mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-10-16 07:59:57 +00:00
Remove extraneous log messages
In particular, these changes filter out the reporting of any errors occurring during the bot shutdown process.
This commit is contained in:
parent
1aaca8545e
commit
b9b057e1f1
3 changed files with 6 additions and 3 deletions
|
@ -57,7 +57,11 @@ class AutoUserDownload : BackgroundService {
|
|||
|
||||
await Task.Delay(200, CancellationToken.None); // Delay a bit (reduces the possibility of hanging, somehow).
|
||||
var dl = guild.DownloadUsersAsync();
|
||||
dl.Wait((int)RequestTimeout.TotalMilliseconds / 2, token);
|
||||
try {
|
||||
dl.Wait((int)RequestTimeout.TotalMilliseconds / 2, token);
|
||||
} catch (Exception) { }
|
||||
if (token.IsCancellationRequested) return; // Skip all reporting, error logging on cancellation
|
||||
|
||||
if (dl.IsFaulted) {
|
||||
Log("Exception thrown by download task: " + dl.Exception);
|
||||
break;
|
||||
|
|
|
@ -94,6 +94,7 @@ public sealed class ShardInstance : IDisposable {
|
|||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
if (arg.Exception is TaskCanceledException) return Task.CompletedTask; // We don't ever need to know these...
|
||||
Log("Discord.Net exception", $"{arg.Exception.GetType().FullName}: {arg.Exception.Message}");
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,6 @@ class ShardManager : IDisposable {
|
|||
if (!Task.WhenAll(shardDisposes).Wait(30000)) {
|
||||
Log("Warning: Not all shards terminated cleanly after 30 seconds. Continuing...");
|
||||
}
|
||||
|
||||
Log($"Uptime: {Program.BotUptime}");
|
||||
}
|
||||
|
||||
private void Log(string message) => Program.Log(nameof(ShardManager), message);
|
||||
|
|
Loading…
Reference in a new issue