Update
Some checks failed
Build docker image / Build-Docker-Image (push) Has been cancelled

This commit is contained in:
2025-01-04 16:15:12 +01:00
parent bdea8e7de3
commit e2e4088a6f
17 changed files with 95 additions and 115 deletions

View File

@@ -15,8 +15,8 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use smallvec::SmallVec;
use tokio::time::{sleep, Duration};
use tokio::sync::Semaphore;
use tokio::time::{sleep, Duration};
use teloxide::prelude::*;
@@ -137,7 +137,10 @@ impl BotsManager {
pub async fn check_pending_updates() {
for (token, bot_data) in BOTS_DATA.iter() {
let error_count = WEBHOOK_CHECK_ERRORS_COUNT.get(&bot_data.id).await.unwrap_or(0);
let error_count = WEBHOOK_CHECK_ERRORS_COUNT
.get(&bot_data.id)
.await
.unwrap_or(0);
if error_count >= 3 {
continue;
@@ -154,19 +157,18 @@ impl BotsManager {
}
if webhook_info.last_error_message.is_some() {
log::error!(
"Webhook last error: {:?}",
webhook_info.last_error_message
);
log::error!("Webhook last error: {:?}", webhook_info.last_error_message);
set_webhook(&bot_data).await;
}
},
}
Err(err) => {
log::error!("Error getting webhook info: {:?}", err);
WEBHOOK_CHECK_ERRORS_COUNT.insert(bot_data.id, error_count + 1).await;
},
WEBHOOK_CHECK_ERRORS_COUNT
.insert(bot_data.id, error_count + 1)
.await;
}
}
}
}