mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-10-02 00:42:10 +00:00
refactor(handlers): split urls.rs into workers, pipeline and startup repair
urls.rs carried five reasons to change: the job channel and its worker pool, the single-flight fetch, URL parsing, the per-URL pipeline, and the startup repair of queued retries. The two with their own lifecycle move out: - url_workers.rs: the bounded channel, its supervised pool and start/stop_url_workers (the pipeline stays in urls.rs, which the workers call). - repair.rs: needs_refetch/apply_refresh/refetch/repair_lost_local_media with their tests, moved whole (the live one keeps its #[ignore]). Also folds the two byte-identical render_fields -> CachedPost mappings (urls.rs and repair.rs) into urls::cached_snapshot, and moves the shared permanent_error test fixture into ctx::test_support.
This commit is contained in:
@@ -65,6 +65,13 @@ pub(crate) mod test_support {
|
||||
RequestError::Api(ApiError::Unknown(message.to_string()))
|
||||
}
|
||||
|
||||
/// The API error a caption edit that changes nothing answers with — what
|
||||
/// the mocks script for a permanent send failure. A `fn` pointer, so it can
|
||||
/// be handed to `MockSender::scripted` as-is.
|
||||
pub(crate) fn permanent_error() -> RequestError {
|
||||
api_error("Bad Request: message is not modified")
|
||||
}
|
||||
|
||||
/// One photo payload item: `media` in the two flags the tests vary (no
|
||||
/// smaller variant, since that is the field most tests leave alone —
|
||||
/// `send`'s own tests build that case directly).
|
||||
|
||||
Reference in New Issue
Block a user