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:
Noi 2023-09-04 16:15:48 -07:00
parent 1aaca8545e
commit b9b057e1f1
3 changed files with 6 additions and 3 deletions

View file

@ -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();
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;

View file

@ -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}");
}

View file

@ -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);