fix(bot): expose errors from the per-minute scheduled task

This commit is contained in:
alyssa 2024-06-15 23:59:38 +09:00
parent 1f11dbf269
commit f14c421e23

View file

@ -83,9 +83,16 @@ public class Bot
// This *probably* doesn't matter in practice but I jut think it's neat, y'know.
var timeNow = SystemClock.Instance.GetCurrentInstant();
var timeTillNextWholeMinute = TimeSpan.FromMilliseconds(60000 - timeNow.ToUnixTimeMilliseconds() % 60000 + 250);
_periodicTask = new Timer(_ =>
_periodicTask = new Timer(async _ =>
{
var __ = UpdatePeriodic();
try
{
await UpdatePeriodic();
}
catch (Exception e)
{
_logger.Error(e, "failed to run once-per-minute scheduled task");
}
}, null, timeTillNextWholeMinute, TimeSpan.FromMinutes(1));
}