From 791e27dced55ca27a9742c5a949491228a8f33c2 Mon Sep 17 00:00:00 2001 From: Pavel Kirilin <win10@list.ru> Date: Wed, 22 Feb 2023 17:47:56 +0400 Subject: [PATCH] Fixed random bot errors. Signed-off-by: Pavel Kirilin <win10@list.ru> --- src/bot/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bot/main.rs b/src/bot/main.rs index 2459f03..fd91a2b 100644 --- a/src/bot/main.rs +++ b/src/bot/main.rs @@ -117,12 +117,18 @@ async fn run(args: BotConfig, client: Client) -> anyhow::Result<()> { .add_filter(TextFilter(&[".rl"], TextMatchMethod::IStartsWith)), ]; + let mut errors_count = 0; + loop { // Get new update let update = client.next_update().await; if update.is_err() { log::error!("{}", update.unwrap_err()); - break; + errors_count += 1; + if errors_count > 10 { + break; + } + continue; } // We get update if there's no error let Some(update_data) = update.ok().and_then(|inner|inner) else{ -- GitLab