mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
Degrading a link-cache entry (previous commit) closed the "user retries right after a failure" case, but left a new one open: the entry could never regain file ids. `cache_sent_task` skipped *every* cached send — its rule was "the entry already holds the ids the next repeat wants" — which is true for a healthy entry and false for a degraded one. So a degraded entry (pixiv's hotlink-protected media, say) kept sending by URL forever, and every repeat paid a download and an upload through the fallback that the file ids would have avoided. Worse than the re-fetch it replaced. The rule is now the one it always meant: a send whose cache snapshot still carries file ids leaves the entry alone, and a send served from a degraded entry writes back the ids it produced (the URLs in the rewritten entry come from that send's own items, so they stay correct). Verified by a test that drives `cache_sent_task` directly with both task shapes: the degraded one updates the entry to the fresh id, the healthy one leaves it untouched. 125 bot tests + 91 x-media tests, live suite (14) pass. `cargo fmt --check`, `cargo clippy --workspace --all-targets --locked -- -D warnings` and `cargo test --workspace --locked` clean.