Repository navigation
Give a paced download's connections to the next queued download (UnpackPacing, UnpackPacingLag, paced-to-unpack status) - #846
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49e2a15311
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # <UnpackPacingLag>. The default. | ||
| # no - never pace: every download runs at full speed and the unpack | ||
| # catches up afterwards (as NZBGet does). Needs room in <InterDir> | ||
| # for the volumes waiting to be extracted. |
There was a problem hiding this comment.
Add the required site coverage for the new settings
Adding UnpackPacing and UnpackPacingLag without updating either site/build.py or site/check.py violates the explicit repository requirement to update both whenever settings are added. Although the generic configuration parser currently discovers these options, add the required generator/check coverage for their unpackpacing and unpackpacinglag anchors rather than leaving the mandated site changes out of this commit.
AGENTS.md reference: AGENTS.md:L304-L306
Useful? React with 👍 / 👎.
| && ((yield_paced && pace_active) | ||
| || unpack_pace_cap | ||
| .is_some_and(|cap| nzb.active_downloads >= cap)) | ||
| && order.as_ref().and_then(|o| o.pace_exempt(&f.filename)) | ||
| == Some(false) |
There was a problem hiding this comment.
Fall back when the replacement download cannot get a connection
When the next queued download is pinned to an active desired server whose connections are exhausted, this condition skips the paced download even if connections usable by that paced download are free. The replacement still counts as a successful pick, so the second pass never runs; subsequently, run() fails server_pool_get_connection() and breaks without trying the passed-over download. Repeated passes therefore leave usable connections idle until unpack reduces the lead below the pacing threshold, instead of retaining the previous paced throughput. Make yielding conditional on the replacement actually being dispatchable, or retry the paced candidates when connection acquisition fails.
Useful? React with 👍 / 👎.
Once direct unpack fell more than 1.5 GB behind, the download was paced to unpack speed and each connection slept in the per-article pacer while holding its slot. On a slow destination disk (6790: ~45 MB/s on a 97%-full HDD array) jobs with unpack averaged 45.7 MB/s against 83.5 MB/s for stock NZBGet, which downloads the next job while the previous one unpacks. - Queue pick: a paced download's volumes ahead of unpack are passed over while another download can use the connections (the volume unpack reads, the waiting window, par2, urgent and extra-priority files still go first). Only when nothing else can use them does the pick go round again with pacing as before; the passed-over download is then paced at once. - Pacer: a download passed over for another (liveorder::note_unpack_yield, 2 s hold) is not slept on, so its in-flight articles finish and free their slots instead of idling at unpack speed. - Options UnpackPacing (yes/no, default yes) and UnpackPacingLag (MB, 256-1048576, default 1536; hard lead 2x, waiting bulk cap +512 MB, so the defaults equal the old constants), applied on boot and hot reload. Documented in rustyget.conf, locales, Settings > Unpack (Advanced), settings-processing and api docs. - listgroups: UnpackPaced, UnpackPaceRate (bytes/s), UnpackPaceYield. The WebUI shows a "paced to unpack (X MB/s)" badge and download-bar note whose tooltip says the downloader is not slow. - Tests: liveorder single paced download still sleeps and reports its rate, yielding frees slots and resumes, UnpackPacing=no never paces, lag clamping; queuecoord real-queue pick gives the next download the connection, re-paces when it runs out, keeps the unpack volume first, and plain order with pacing off; WebUI dual-progress badge checks. Working history: origin/backup/unpack-pacing-queue-207cbc3a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
207cbc3 to
e5f5afc
Compare
Once direct unpack fell more than 1.5 GB behind, the download was paced to unpack speed and each connection slept in the per-article pacer while holding its slot. On a slow destination disk (6790: ~45 MB/s on a 97%-full HDD array) jobs with unpack averaged 45.7 MB/s against 83.5 MB/s for stock NZBGet, which downloads the next job while the previous one unpacks. - Queue pick: a paced download's volumes ahead of unpack are passed over while another download can use the connections (the volume unpack reads, the waiting window, par2, urgent and extra-priority files still go first). Only when nothing else can use them does the pick go round again with pacing as before; the passed-over download is then paced at once. - Pacer: a download passed over for another (liveorder::note_unpack_yield, 2 s hold) is not slept on, so its in-flight articles finish and free their slots instead of idling at unpack speed. - Options UnpackPacing (yes/no, default yes) and UnpackPacingLag (MB, 256-1048576, default 1536; hard lead 2x, waiting bulk cap +512 MB, so the defaults equal the old constants), applied on boot and hot reload. Documented in rustyget.conf, locales, Settings > Unpack (Advanced), settings-processing and api docs. - listgroups: UnpackPaced, UnpackPaceRate (bytes/s), UnpackPaceYield. The WebUI shows a "paced to unpack (X MB/s)" badge and download-bar note whose tooltip says the downloader is not slow. - Tests: liveorder single paced download still sleeps and reports its rate, yielding frees slots and resumes, UnpackPacing=no never paces, lag clamping; queuecoord real-queue pick gives the next download the connection, re-paces when it runs out, keeps the unpack volume first, and plain order with pacing off; WebUI dual-progress badge checks. Working history: origin/backup/unpack-pacing-queue-207cbc3a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e5f5afc to
ea70abc
Compare
Once direct unpack fell more than 1.5 GB behind, the download was paced to unpack speed and each connection slept in the per-article pacer while holding its slot. On a slow destination disk (6790: ~45 MB/s on a 97%-full HDD array) jobs with unpack averaged 45.7 MB/s against 83.5 MB/s for stock NZBGet, which downloads the next job while the previous one unpacks. - Queue pick: a paced download's volumes ahead of unpack are passed over while another download can use the connections (the volume unpack reads, the waiting window, par2, urgent and extra-priority files still go first). Only when nothing else can use them does the pick go round again with pacing as before; the passed-over download is then paced at once. - Pacer: a download passed over for another (liveorder::note_unpack_yield, 2 s hold) is not slept on, so its in-flight articles finish and free their slots instead of idling at unpack speed. - Options UnpackPacing (yes/no, default yes) and UnpackPacingLag (MB, 256-1048576, default 1536; hard lead 2x, waiting bulk cap +512 MB, so the defaults equal the old constants), applied on boot and hot reload. Documented in rustyget.conf, locales, Settings > Unpack (Advanced), settings-processing and api docs. - listgroups: UnpackPaced, UnpackPaceRate (bytes/s), UnpackPaceYield. The WebUI shows a "paced to unpack (X MB/s)" badge and download-bar note whose tooltip says the downloader is not slow. - Tests: liveorder single paced download still sleeps and reports its rate, yielding frees slots and resumes, UnpackPacing=no never paces, lag clamping; queuecoord real-queue pick gives the next download the connection, re-paces when it runs out, keeps the unpack volume first, and plain order with pacing off; WebUI dual-progress badge checks. Working history: origin/backup/unpack-pacing-queue-207cbc3a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ea70abc to
f85de68
Compare
#846, #849) Rebases the remaining open PRs cleanly onto main (f0fb231, after #847 landed) with proactive fixes and edge-case hardening: - #845 (queue-lock-coord): spin-then-park RawLock and event-driven coordinator run-loop wait on wait_lock, with SeqCst CAS failure ordering on RawLock::try_take for weak memory models. - #846 (unpack-pacing-queue): yield a paced download's connections to other queued downloads while exempting the active unpack volume, UnpackPacing / UnpackPacingLag options, listgroups fields, WebUI dual-progress badge/tests, plus: - site/build.py and site/check.py validation across LAYOUT and OPTION_REQUIRES in webui/config.js so every exposed option has an options.html anchor; - Vale prose fixes in site/content/api.md and settings-processing.md; - queuecoord::pick_next_article desired-server exclusion retry and deferred apply_pick_yield after connection acquisition, plus PostStrategy=sequential exemption for unpack-paced downloads. - Follow-up fix for #847 (rust/src/articledl.rs): enforce immediate MEM_SLOT_TIER <= MEM_TIER clamp on step-down (resetting MEM_SLOT_GATE) and fall back to decision.cache_source for source attribution. - #849 (zipview-to-zipfast): switch unpack.rs and streamrepair.rs to zipfast::zipview (c7ee07db) and drop the standalone zipview crate.
Once direct unpack fell more than 1.5 GB behind, the download was paced to unpack speed and each connection slept in the per-article pacer while holding its slot. On a slow destination disk (6790: ~45 MB/s on a 97%-full HDD array) jobs with unpack averaged 45.7 MB/s against 83.5 MB/s for stock NZBGet, which downloads the next job while the previous one unpacks. - Queue pick: a paced download's volumes ahead of unpack are passed over while another download can use the connections (the volume unpack reads, the waiting window, par2, urgent and extra-priority files still go first). Only when nothing else can use them does the pick go round again with pacing as before; the passed-over download is then paced at once. - Pacer: a download passed over for another (liveorder::note_unpack_yield, 2 s hold) is not slept on, so its in-flight articles finish and free their slots instead of idling at unpack speed. - Options UnpackPacing (yes/no, default yes) and UnpackPacingLag (MB, 256-1048576, default 1536; hard lead 2x, waiting bulk cap +512 MB, so the defaults equal the old constants), applied on boot and hot reload. Documented in rustyget.conf, locales, Settings > Unpack (Advanced), settings-processing and api docs. - listgroups: UnpackPaced, UnpackPaceRate (bytes/s), UnpackPaceYield. The WebUI shows a "paced to unpack (X MB/s)" badge and download-bar note whose tooltip says the downloader is not slow. - Tests: liveorder single paced download still sleeps and reports its rate, yielding frees slots and resumes, UnpackPacing=no never paces, lag clamping; queuecoord real-queue pick gives the next download the connection, re-paces when it runs out, keeps the unpack volume first, and plain order with pacing off; WebUI dual-progress badge checks. Working history: origin/backup/unpack-pacing-queue-207cbc3a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f85de68 to
57ba238
Compare
…ocs fixes Rebases PR #850 cleanly onto main (57ba238, after #845, #846, #847, and #851 landed), rolls in PR #849, and includes follow-up hardening and documentation validation fixes: - #849 (zipview-to-zipfast): switch unpack.rs and streamrepair.rs to zipfast::zipview (c7ee07dbf4c9817bb8d0dbf07684c643932a96e5) and drop the standalone archived zipview crate (keeping #851's nntp-rs pin cf5df57ac49c6709ddde86f3f7eeff49e032821d; 1 zipview package in Cargo.lock). - #845 follow-up (rust/src/qqueue.rs): use Ordering::SeqCst on RawLock::try_take CAS failure so ARM64 / weak memory models keep the Dekker store-load pair against unlock(). - #846 follow-up (rust/src/queuecoord.rs, site/, site/content/): - Update site/build.py (validate_config_js_options) and site/check.py to verify every option in webui/config.js LAYOUT and OPTION_REQUIRES has an options.html anchor; - Fix Vale Google.Quotes and Google.OxfordComma findings in site/content/api.md and site/content/settings-processing.md; - Update queuecoord::pick_next_article and Coordinator::run() (excluded_nzbs retry, deferred apply_pick_yield after conn_ptr != 0, and PostStrategy=sequential exemption for unpack-paced downloads) so desired_server_id exhaustion skips to other work or falls back cleanly without falsely unpacing the yielding download. - #847 follow-up (rust/src/articledl.rs): clamp MEM_SLOT_TIER down immediately whenever (slot_current as i32) > next_tier (resetting MEM_SLOT_GATE) and fall back to decision.cache_source for attribution.
…s checks (#850) Applies follow-up hardening, documentation validation, and Vale fixes after #845, #846, #847, and #849 landed in main: - rust/src/qqueue.rs: use Ordering::SeqCst on RawLock::try_take CAS failure for weak memory models (ARM64). - rust/src/queuecoord.rs: retry pick_next_article around desired_server_id exhaustion via excluded_nzbs, defer apply_pick_yield until conn_ptr != 0, and exempt unpack-paced downloads during yield_paced pass 1 in sequential_active_priority (with unit test coverage). - rust/src/articledl.rs: clamp MEM_SLOT_TIER down immediately whenever (slot_current as i32) > next_tier (resetting MEM_SLOT_GATE) and fall back to decision.cache_source for source attribution. - site/build.py, site/check.py: validate every option in webui/config.js LAYOUT and OPTION_REQUIRES has an options.html anchor. - site/content/api.md, site/content/settings-processing.md: fix Vale Google.Quotes and Google.OxfordComma findings. Working history: origin/backup/rollup-pr-845-846-847-849-2a3e0773.
Requested by Engineer · project thread
Why
Bench report
backbone-race.md, cause 1: once direct unpack falls more than 1.5 GB behind, RustyGet paces that download to unpack speed. The per-connection pacer (articledl.rsDownloadPacer::received→liveorder::unpack_pace_delay) sleeps while holding its slot. On the server's 97%-full HDD array unpack runs at about 45 MB/s:UnpackPauseQueue=no)For a single job the wall time comes out about the same. With a queue it's a real loss: NZBGet downloads job N+1 at line rate while job N unpacks, but RustyGet keeps job N's slots asleep.
What changes
flowchart TD A[Queue pick] --> B{Download paced to its unpack?} B -- no --> P[Pick as before] B -- yes --> C{Volume exempt?<br/>unpack's volume, par2, urgent, extra priority} C -- yes --> P C -- no --> D[Pass it over] D --> E{Another download has work?} E -- yes --> F[Give it the connection<br/>note_unpack_yield: paced download's in-flight articles stop sleeping for 2 s] E -- no --> G[Second pass: paced download gets articles, pacer sleeps at unpack speed as before] classDef main fill:#a8400f,color:#fff,stroke:#a8400f classDef ok fill:#1d6f60,color:#fff,stroke:#1d6f60 class F main class G,P okqueuecoord.rs). A paced download's volumes ahead of unpack are passed over while another download in the queue can use the connections. Exempt and still picked first: the volume unpack is reading, the lookahead window while unpack waits, par2, urgent and extra-priority files. If nothing else can use the connections, the pick goes round once more with pacing exactly as before (including the hard/stall/debt connection caps).liveorder.rs). A download passed over for another one (note_unpack_yield, refreshed on every such pick, 2 s hold) isn't slept on. Its in-flight articles finish at line rate and free their slots instead of idling in them. When the other work runs out, the hold lapses and pacing resumes.rustyget.conf, locales, Settings > Unpack (Advanced),options.htmlvia the generator,settings-processingandapidocs):UnpackPacing=yes|no(defaultyes).nonever paces: every download runs at full speed and the unpack catches up afterwards, as in NZBGet.UnpackPacingLag=1536(MB, 256-1048576). The soft lead. The hard lead is 2x, and the waiting bulk cap is the soft lead + 512 MB, so the defaults match the old constants exactly.listgroupsaddsUnpackPaced,UnpackPaceRate(bytes/s) andUnpackPaceYield. The WebUI shows a paced to unpack (45.0 MB/s) badge next to the status, plus the same note on the download bar. The tooltip says the downloader isn't slow and, when it applies, that the next download has the connections.Rebased over #844, which disables pacing while volumes are held (
has_holds); both gates are kept. #845's event-driven coordinator wait still runs a pick at least every 5 ms while there is work, so the 2 s yield hold is refreshed.Screenshots (offline fixture, synthetic names)
Desktop, light:
Desktop, dark:
Phone, light:
Tests
New unit tests:
liveorder::single_paced_download_still_sleeps_and_reports_its_rate: alone, the pacer still sleeps, and the status reports the rate.liveorder::yielding_download_frees_its_slots_instead_of_sleeping: no sleep while yielding, and pacing resumes when the hold lapses.liveorder::unpack_pacing_off_never_paces: no delay, cap, status orpace_activewith the switch off.liveorder::unpack_pacing_lag_option_is_clamped_megabytes.queuecoord::paced_download_gives_its_connections_to_the_next_queued_download, which uses the real queue andget_next_article:UnpackPacing=no, plain queue order.tests/webui/dual-progress.js: badge text, case, tooltip and bar note in light and dark at 5 widths. Geometry and WCAG contrast checks still pass.Results:
Final head:
57ba238f, one signed squash commit on main0f91beab(rebased over #844, #847, #845, #848 and #851; the only conflict was the defaults-array count inoptions.rs, now 138).macOS (Apple silicon, local, on
57ba238f):(cd rust && RUSTFLAGS="-D warnings" cargo nextest run --retries 1):2190 tests run: 2190 passed, 8 skipped,nextest_exit=0CARGO_BUILD_JOBS=8 just test-daemon 8:All 10 daemon checks passed!,daemon_exit=0tests/functional/dupefallback/harness.py, on the pre-rebase tree207cbc3a):259cfdae(built and run on the same machine), so pre-existing: queuebatchstart (peak_in_flight=16 of 30), slotfinishedlive (gave_a=0)node tests/webui/dual-progress.js:Dual progress checks (160): PASSLinux (GitHub Actions on
57ba238f):buildpasses. Tests pass on ubuntu-24.04, ubuntu-24.04-arm, ubuntu-26.04, ubuntu-26.04-arm and macos-15. ISA checks: avx2, avx512 and neon pass; apple-m was still running at merge time. Earlier heads hit runner infrastructure faults: two "self-hosted runner lost communication" failures, and one arm job with no output for 56 minutes. Onf85de689, apple-m failed one test (progressive_unpack::a_crash_before_a_grouped_refill_commits_refills_the_hole_again); that test is unrelated to this change and passes locally.Linux farm (
rg-farm val): not run. Its spot builders no longer exist in the GCP project.Review: clean-room review came back g2g on
ea70abc1, the squashed head before the last two rebases, which didn't touch this PR's logic. Its one minor note was fixed: after the fallback pass, the yield hold now clears at once.Not measured yet
There's no before/after throughput on :6790 yet: this PR doesn't deploy (the redeploy happens once the parallel PRs land). Expected effect with a queue: the next job runs near line rate (~83 MB/s) while the paced job's unpack catches up, as in stock NZBGet. Single-job wall time stays about the same.
🤖 Generated with Claude Code