Repository navigation
fix: don't grab past MAM's unsatisfied limit when its count lags; respect its download freeze - #65
Merged
Merged
Conversation
…pect its download freeze
MAM only counts a snatch once its tracker hears from the torrent client. While it
rejected the client's announces (an unregistered IP after mousehole failed), its
count stayed ~20 short and Shelfmark grabbed up to the limit, freezing downloads
for a day.
- Each grab also counts the MAM torrents in the torrent client still downloading
or short of 72 hours' seeding, and goes by the higher of that and MAM's count.
- MAM downloads wait while the client's MAM torrents show rejected announces
("Unrecognized host/PassKey"), and while MAM can't be read (the per-grab check
no longer fails open).
- MAM's download freeze is read from a refused torrent download, or entered by
hand in the account panel; MAM downloads wait it out, and the top bar counts
down to it. Kept across restarts.
- Deluge, qBittorrent and Transmission report each MAM torrent's tracker error;
qBittorrent's torrents with no working tracker are no longer missed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0184DMrDNkAEmGzPntj3ziqB
This was referenced Oct 5, 2026
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.
Why
When mousehole failed ("Invalid session - ASN mismatch"), MAM rejected Deluge's announces ("Unrecognized host/PassKey"). MAM only counts a snatch once its tracker hears from the client, so its unsatisfied count sat ~20 short (130 vs. 150 actually in Deluge). Shelfmark only covered MAM's lag for snatches from the last 15 minutes, so it kept grabbing. When announces resumed, the account was at the limit, and the next grab froze MAM downloads for a day.
What changes
TrackerTorrentgainstracker_error, reported by Deluge (tracker_status), Transmission (trackerStats) and qBittorrent (/torrents/trackers). Only rejections of the client itself trigger the hold (passkey, unrecognized host, unauthorized). Timeouts and errors on a single torrent don't.mam_freezemodule, persisted to the config dir):.torrentreply ("Time Till Download Allowed: 1d 02:04:02"; a day if no time is given).POST/DELETE /api/mam/freeze, admin only).trackerfield) were dropped from the MAM list. They're now looked up individually, with each torrent's tracker cached and idle torrents skipped.Testing
tests/prowlarr/test_mam_unsat_safeguards.py: the incident replayed (MAM 130, client 150), parsing MAM's refusal text, how the freeze is stored and when it ends, holds for each reason, tracker errors from each client, and the qBittorrent cache.grab_allowance, and there are route tests for the freeze endpoints.pytest(excluding integration/e2e): 3758 passed. 7 failures also happen on a cleanmainin this container (entrypoint/hardlink permission tests that fail when run as root).tsc, oxlint and oxfmt are clean, and 356 vitest tests pass.🤖 Generated with Claude Code
https://claude.ai/code/session_0184DMrDNkAEmGzPntj3ziqB
Generated by Claude Code