mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-10-05 01:12:06 +00:00
send: reuse one process-wide Bot for queue workers
handle_task and dead_letter_notify built a fresh Bot (env parse + HTTP client) per queue item. A single LazyLock<Bot> is forced at startup so a missing TELOXIDE_TOKEN fails fast instead of on the first task.
This commit is contained in:
@@ -43,6 +43,9 @@ async fn main() {
|
||||
log::info!("Starting bot");
|
||||
|
||||
let bot = Bot::from_env();
|
||||
// Force the queue workers' shared Bot to initialize now so a missing
|
||||
// token fails at startup, not on the first queued task.
|
||||
let _ = &*send::BOT;
|
||||
|
||||
// Register the command list with Telegram (client `/` menu).
|
||||
if let Err(e) = handlers::register_commands(&bot).await {
|
||||
|
||||
Reference in New Issue
Block a user