mirror of
https://github.com/sabnzbd/sabnzbd.git
synced 2026-07-30 17:09:10 -04:00
* Fix RuntimeError from dict mutation in stop_idle_jobs (#3431) Collecting exhausted articles into a snapshot list while holding nzf.lock, then calling register_article outside the iteration. This prevents RuntimeError when register_article -> nzf.remove_article pops from nzf.articles (a dict) while stop_idle_jobs is iterating it. The original code infd3ece31cused `nzf.articles[:]` which was safe when articles was a list. When44d94226echanged articles to a dict the protective copy was dropped, leaving bare dict iteration that mutates mid-loop. The collect-then-act pattern matches nzf_remove_list in nzb/object.py and the empty-nzo list already used in stop_idle_jobs itself. It also correctly calls register_article outside nzf.lock, consistent with its own "not locked for performance" contract. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Apply Black formatting to nzbqueue.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Soften comment per maintainer feedback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>