fix(lidarr): complete a request only when the album actually came back (#5263)
release / govulncheck (push) Failing after 33s
release / web (push) Successful in 1m21s
release / go (push) Successful in 1m44s
release / integration (push) Successful in 4m37s
release / android (push) Successful in 5m29s
release / Build signed APK (releases and dev) (push) Successful in 5m34s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Failing after 33s
release / web (push) Successful in 1m21s
release / go (push) Successful in 1m44s
release / integration (push) Successful in 4m37s
release / android (push) Successful in 5m29s
release / Build signed APK (releases and dev) (push) Successful in 5m34s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
Re-acquisition targets albums with ANY track missing, and completion only asked for a track on disk, so the tracks that never left completed every re-acquisition request the moment Lidarr accepted the add (52 on the deploy, each ~150ms after its add). An album or track request now completes when an album named by its release or group has a track on disk AND either a track arrived after the request (a new album, or Lidarr fetching another release into its own row) or no track that was missing at the request is still missing. added_at is the arrival clock; updated_at moves on every tag re-read. Migration 0071 reopens completed album/track requests whose matched album fails that test, as approved with the match cleared; the Lidarr add stays confirmed, so nothing is re-sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
-- #5263: the reconciler completed album and track requests as soon as the album
|
||||
-- had any track on disk. Re-acquisition targets albums with only SOME tracks
|
||||
-- missing, so those requests completed the moment Lidarr accepted the add,
|
||||
-- with nothing downloaded.
|
||||
--
|
||||
-- Reopen every completed album/track request whose matched album does not meet
|
||||
-- the corrected test (see albumForRequest in internal/lidarrrequests): a track
|
||||
-- that arrived after the request, or no track that was already missing at the
|
||||
-- request still missing. The reconciler then judges them again; the Lidarr add
|
||||
-- stays confirmed, so nothing is re-sent. Requests that genuinely completed
|
||||
-- meet the test and are left alone.
|
||||
UPDATE lidarr_requests lr
|
||||
SET status = 'approved',
|
||||
completed_at = NULL,
|
||||
matched_album_id = NULL,
|
||||
matched_track_id = NULL,
|
||||
updated_at = now()
|
||||
WHERE lr.status = 'completed'
|
||||
AND lr.kind IN ('album', 'track')
|
||||
AND lr.matched_album_id IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM tracks t
|
||||
WHERE t.album_id = lr.matched_album_id
|
||||
AND t.missing_since IS NULL
|
||||
AND t.added_at > lr.requested_at)
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM tracks t
|
||||
WHERE t.album_id = lr.matched_album_id
|
||||
AND t.missing_since IS NOT NULL
|
||||
AND t.missing_since < lr.requested_at);
|
||||
Reference in New Issue
Block a user