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:
2026-08-08 20:25:22 +08:00
parent 99009aae9a
commit 44cba8abe0
2 changed files with 11 additions and 2 deletions
+3
View File
@@ -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 {