Repository navigation
perf(queue): share SABnzbd's history read while it shows post-processing, and smaller follow-ups - #700
Merged
Conversation
…ing, and smaller follow-ups Where SABnzbd's queue reads paused and its slots cannot tell the wait for post-processing from a pause by hand, `#waitOn` reads the "Pause Downloading During Post-Processing" switch, shared for ten seconds, and, when it is on, the history's first ten rows, which it read again on every call. A history read that shows a download in post-processing is now shared the same way: `cached()` takes a `keep` check, applied under the identity check that already guards a failed read, so a later read in its place is never dropped. While the wait lasts, the calls that reach the read (get_queue, diagnose_media, pause_downloads and retry_download among them) share one request every ten seconds, and for up to ten seconds after it ends the queue can still read as held by it. A read that shows none is not kept, since post-processing can start at any moment: a stale "nothing in post-processing" would have pause_downloads answer "already paused" for a queue the wait has just started holding, and send nothing, and would have get_queue, diagnose_media and retry_download name a pause by hand, or no hold for a Force job, where the wait holds the download. A failed read still answers no, and the next call reads again. get_stack_health never reaches this read. retry_download read its hold back by joining the flags set in `HOLD_FLAGS` order and comparing that with each `HOLD_FIELDS` entry joined, which held only while every entry listed its flags in that order. It now takes the hold whose fields are exactly the ones set, whatever their order. docs/tools.md says which history reads are shared, and the rest of that pause_downloads paragraph is re-wrapped, so no line in it runs past 80 columns.
Owner
|
Thanks, this looks good. The
|
bardesss
pushed a commit
that referenced
this pull request
Nov 17, 2026
…he shared history read for two more tools (#702) retry_download's `applied` read its hold back with a `find()` inside the object spread of its outcome. That expression is now `holdOf`, next to `HOLD_FIELDS`, exported and tested on its own: the hold whose fields are exactly the flags set, whatever their order. SABnzbd's history read is shared for ten seconds while it shows a download in post-processing (#700), so for up to ten seconds after the wait ends a queue paused by hand can still read as the wait. The pause_downloads section of docs/tools.md said so; the diagnose_media and retry_download sections now say it too, and the pause_downloads section words the resume preview's wait sentence as the condition it is. Each paragraph is re-wrapped from the changed line on. get_queue makes the same read but reports no hold (its rows leave `heldBy` out), so its section needs nothing. Co-authored-by: arr-mcp-contributor <contributor@example.invalid>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Your three optional follow-ups on #689.
#waitOnreads the switch, shared for ten seconds, and, when it is on, the history's first ten rows, which it read again on every call. A history read that shows a download in post-processing is now shared the same way.cached()takes an optionalkeepcheck for that, applied under the identity check that already guards a failed read (the reasonTtlCache.getgives forttlFor), so a later read in its place is never dropped. While the wait lasts, the calls that reach the read (get_queue, diagnose_media, pause_downloads and retry_download among them) share one request every ten seconds. A read that shows none is not kept, so a queue paused by hand still costs one history read per call, as on main. Keeping it would let a stale "nothing in post-processing" stand for up to ten seconds after post-processing starts:pause_downloadswould answer "already paused" for a queue the wait has just started holding, and send nothing, and get_queue, diagnose_media and retry_download would name a pause by hand, or no hold for a Force job. For up to ten seconds after the wait ends, a queue still paused by hand can read as the wait, as it already does during the wait; thepause_downloadssection ofdocs/tools.mdnow says so. A failed read still answers no, and the next call reads again.get_stack_healthnever reaches this read: the only queues it reads are those of the torrent clients a Cleanuparr rule set maps.retry_download'sappliedtook the hold whoseHOLD_FIELDSentry, joined, equalled the flags set, joined inHOLD_FLAGSorder. It now takes the hold whose fields are exactly the ones set, whatever their order.pause_downloadsparagraph is re-wrapped from the changed sentence on, so no line in it runs past 80 columns.No tool description, preview or other client text changes.
Verified
The changed test, which expects one history read across two
getQueuecalls and a pause state read while the history shows the wait, fails on main, which makes three. A new test has the history show nothing and then a download in post-processing, and checks thatgetQueueand the pause state read find the wait on the next call; it fails with a cache that also keeps a history showing nothing, and on main, which reads four times. A tool-level test checks that apause_downloadspreview stops being a no-op once the wait starts; it fails with a cache that keeps a history showing nothing. Another refuses the first history read and checks that the next call reads again and finds the wait; it fails with a cache that keeps the failed read. Three newcached()tests check that a readkeeprefuses is read again, that a refused read resolving late leaves a newer one in place, and that akeepthat throws drops its read; each fails with its guard removed. WithqueueAndPostPaused's two flags swapped inHOLD_FIELDS, theretry_downloadtest for that hold fails on main and passes here, and a read-back that takes a hold whose fields are only some of those set is caught too.There is no SABnzbd test instance, so this rests on the tests, as #689 did.
Gates on Node 24.22.2: lint, typecheck, build and codegen exit 0 with no generated diff, and 207 test files / 7,182 tests pass (main: 7,176).