mirror of
https://github.com/Jetsparrow/jetherald.git
synced 2026-01-20 23:56:08 +03:00
Log exceptions while checking heartbeats
This commit is contained in:
parent
3e16199c1f
commit
ae4cbe0632
@ -89,16 +89,23 @@ namespace JetHerald
|
||||
{
|
||||
await Task.Delay(1000 * 10, token);
|
||||
|
||||
foreach (var chatSent in await Db.GetExpiredTopics(token))
|
||||
try
|
||||
{
|
||||
var formatted = $"!{chatSent.Description}!:\nTimeout expired at {chatSent.ExpiryTime}";
|
||||
if (chatSent.Service == "Telegram")
|
||||
await TelegramBot.SendTextMessageAsync(chatSent.ChatId, formatted, cancellationToken: token);
|
||||
else if (chatSent.Service == "Discord")
|
||||
await SendMessageToDiscordChannel(chatSent.ChatId, formatted);
|
||||
}
|
||||
foreach (var chatSent in await Db.GetExpiredTopics(token))
|
||||
{
|
||||
var formatted = $"!{chatSent.Description}!:\nTimeout expired at {chatSent.ExpiryTime}";
|
||||
if (chatSent.Service == "Telegram")
|
||||
await TelegramBot.SendTextMessageAsync(chatSent.ChatId, formatted, cancellationToken: token);
|
||||
else if (chatSent.Service == "Discord")
|
||||
await SendMessageToDiscordChannel(chatSent.ChatId, formatted);
|
||||
}
|
||||
|
||||
await Db.MarkExpiredTopics(token);
|
||||
await Db.MarkExpiredTopics(token);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.LogError(e, "Exception while checking heartbeats");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user