Conversation
Downloads parked in ImportBlocked stay on the Activity page forever, even once the situation behind them is gone — e.g. the audiobook was deleted, or the book was received another way and already has files. Nothing clears them, so they pile up as confusing "activity" that's no longer relevant. Add a small background reaper (mirrors the existing MovedDownloadCleanup pair: processor + hosted service on a relaxed 5-minute cadence) that removes an ImportBlocked download when it can no longer resolve to anything actionable: - it has no associated audiobook, or - its audiobook no longer exists (deleted), or - its audiobook already has at least one file (received another way). A blocked download whose audiobook still exists with no files is left alone — that's a genuine unresolved failure the user may still want to retry. Tests cover all three reap conditions, the leave-alone case, and that non-blocked downloads are never touched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Downloads parked in
ImportBlockedstay on the Activity page indefinitely, even after the situation behind them is gone — e.g. the audiobook was deleted, or the book was received another way and already has files. Nothing ever clears them, so they accumulate as stale "activity" that's no longer relevant or actionable.This adds a small background reaper that removes an
ImportBlockeddownload when it can no longer resolve to anything actionable.Reap conditions
An
ImportBlockeddownload is removed when:A blocked download whose audiobook still exists with no files is deliberately left alone — that one is a genuine unresolved failure the user may still want to retry (via the existing
retry-importaction).Design
Mirrors the existing
MovedDownloadCleanuppair — a processor (StaleBlockedDownloadCleanupProcessor) plus a hostedBackgroundService, registered through the sameAddHostedProcessor<…>helper. It runs on a relaxed 5-minute cadence (1-minute initial delay) since this is low-urgency housekeeping, not the download-polling hot path. Removal uses the sameIDownloadRepository.RemoveAsyncpath as the manual delete endpoint. Each reap is logged with its reason.GetActiveAsyncintentionally excludesImportBlocked, so the reaper reads the full set and filters.Tests
StaleBlockedDownloadCleanupProcessorTestscovers all three reap conditions, the leave-alone case (audiobook exists, no files), and that non-ImportBlockeddownloads are never touched. Architecture gates (file-focus, test conventions) green.Note on scope
The "already has files" condition is the one judgement call — it treats a book that's been received as satisfying any older blocked import for it. If you'd prefer that gated (e.g. only when the block is also older than N hours, to avoid ever dropping a just-failed upgrade), easy to add — flagging it for review.
🤖 Generated with Claude Code