Make the UI's Download button download the episode you clicked
POST /api/enclosures/{id}/download requeued the row and asked for a
normal scan, but a scan takes the lowest-id pending rows up to
max_new_per_check. With a large backlog and a small cap the requested
row was never a candidate, so other episodes downloaded while it stayed
pending.
A queue expresses what is outstanding, not what was asked for. Download
is now its own command that fetches one specific enclosure immediately,
ignoring queue order and the per-scan cap, still via the single worker.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RPyeapneuXrCdojsaiXGbe
This commit is contained in:
11
src/ipc.rs
11
src/ipc.rs
@@ -90,6 +90,12 @@ pub enum Command {
|
||||
#[serde(default)]
|
||||
dry_run: bool,
|
||||
},
|
||||
/// Fetch one specific enclosure now, ignoring max_new_per_check and the queue order.
|
||||
/// A scan cannot express "this one, now": it takes the lowest-id pending rows up to
|
||||
/// the per-scan cap, so an explicit request has to bypass both.
|
||||
Download {
|
||||
enclosure: i64,
|
||||
},
|
||||
Status,
|
||||
}
|
||||
|
||||
@@ -234,6 +240,11 @@ mod tests {
|
||||
let got: Command = serde_json::from_str(r#"{"cmd":"reap","dry_run":true}"#).unwrap();
|
||||
assert!(matches!(got, Command::Reap { dry_run: true }));
|
||||
|
||||
// "Download this one now" is its own command precisely because a scan cannot
|
||||
// express it: a scan takes the lowest-id pending rows up to max_new_per_check.
|
||||
let got: Command = serde_json::from_str(r#"{"cmd":"download","enclosure":11}"#).unwrap();
|
||||
assert!(matches!(got, Command::Download { enclosure: 11 }));
|
||||
|
||||
assert!(serde_json::from_str::<Command>(r#"{"cmd":"nope"}"#).is_err());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user