mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
fix: repair four correctness defects in the send/state/handler paths
- send: the PHOTO_INVALID_DIMENSIONS marker never matched (the description is lower-cased, the marker was not), so oversized photos sent by URL were classified Permanent instead of taking the download-and-downscale fallback. - inline: the debounce state was one global slot, so a second user's query cancelled the first user's pending answer entirely; it is now per user. - state: prune_expired wrote back a stale snapshot without the per-chat lock, clobbering a concurrent update() (lost edit-message record -> "Expired"); it now re-reads and prunes under the same lock update() uses. - send/queue: a task dead-lettered on retry exhaustion kept its keep-alive temp media (ugoira MP4) alive until process exit; dead_letter_notify now releases it, and enqueue_retry releases when the enqueue itself fails. Also folds the duplicated retry enqueue in post_send_actions into send::enqueue_retry (single clock source, single place that releases). Tests: +6 (marker, per-user debounce x3, keep-alive release, prune contract x2); the marker and keep-alive cases were verified to fail before the fix. cargo fmt/clippy clean, 52 + 69 tests pass.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
//! Callback query handling: the edit-before-forward prompt's "forward" and
|
||||
//! "template|<name>" buttons.
|
||||
|
||||
use super::urls::enqueue_retry;
|
||||
use super::{CHAT_STORE, CONFIG, TASK_QUEUE};
|
||||
use crate::db::unix_now;
|
||||
use crate::send::{self, Task};
|
||||
@@ -83,7 +82,7 @@ pub async fn callback_query_handler(bot: Bot, query: CallbackQuery) -> Result<()
|
||||
task,
|
||||
}) => {
|
||||
log::info!("forward queued for retry in {delay_seconds:.1}s");
|
||||
enqueue_retry(&TASK_QUEUE, *task, delay_seconds).await;
|
||||
send::enqueue_retry(&TASK_QUEUE, *task, delay_seconds).await;
|
||||
bot.answer_callback_query(callback_query_id)
|
||||
.text("Forward queued for retry.")
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user