fix: a release its download client will not let Minstrel follow is held back, not taken every pass (#6176)
release / govulncheck (push) Successful in 16s
release / web (push) Successful in 1m21s
release / go (push) Successful in 1m34s
release / integration (push) Successful in 5m5s
release / android (push) Successful in 5m7s
release / Build signed APK (releases and dev) (push) Successful in 5m14s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 22s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 16s
release / web (push) Successful in 1m21s
release / go (push) Successful in 1m34s
release / integration (push) Successful in 5m5s
release / android (push) Successful in 5m7s
release / Build signed APK (releases and dev) (push) Successful in 5m14s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 22s
release / Verify release artifacts (tag releases only) (push) Skipped
The Black Keys' Ohio Players was grabbed 40 times in a day. FabledExchange already held the torrent under another category from before Minstrel took the downloads over: the add answered "duplicate", which counted as added, and Exchange's listing, filtered to Minstrel's category, never showed it. Half an hour later the grab ended gone, and the next pass took it again. - A duplicate add that the client does not list for Minstrel is not a grab: the release is held back for a day with the client's own reason (already downloading X (category)), and the search moves on. Forced, it is refused with that reason. - A release that ends gone a second time within a week is held back for a day, whatever the cause. - release_blocks gains the reason 'gone' (migration 0098), shown as "Held back: its download client lost track of it". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package acquire
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -153,6 +154,8 @@ type fakeClient struct {
|
||||
addErr error
|
||||
deleted []string
|
||||
progress float64
|
||||
// elsewhere: the client holds it but does not list it for Minstrel.
|
||||
elsewhere bool
|
||||
}
|
||||
|
||||
func (c *fakeClient) AddTorrent(_ context.Context, a downloader.Add) error {
|
||||
@@ -161,6 +164,9 @@ func (c *fakeClient) AddTorrent(_ context.Context, a downloader.Add) error {
|
||||
}
|
||||
|
||||
func (c *fakeClient) Torrents(_ context.Context, hashes ...string) ([]downloader.Torrent, error) {
|
||||
if c.elsewhere {
|
||||
return nil, nil
|
||||
}
|
||||
return []downloader.Torrent{{Hash: hashes[0], Progress: c.progress}}, nil
|
||||
}
|
||||
|
||||
@@ -212,6 +218,28 @@ func TestGrab_AClientThatAlreadyHasItCounts(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A duplicate the client does not list for Minstrel sits under another
|
||||
// category, where it would read as gone half an hour later (#6176). It is set
|
||||
// aside rather than taken; forced, it is refused with the client's reason.
|
||||
func TestGrab_ADuplicateHeldOutsideMinstrelIsNotTaken(t *testing.T) {
|
||||
client := &fakeClient{addErr: fmt.Errorf("%w: already downloading Ohio Players (lidarr)", downloader.ErrDuplicate), elsewhere: true}
|
||||
s := &Service{Grabber: &Downloader{Client: client, Landing: "/downloads"}}
|
||||
c := Candidate{Verdict: Grab, InfoHash: "aaaa", Source: indexer.Result{Magnet: "magnet:?xt=urn:btih:aaaa"}}
|
||||
took := s.Grab(context.Background(), ram, &c, nil, false, Origin{By: OriginSchedule})
|
||||
if took.Added || !took.Refused {
|
||||
t.Fatalf("took %+v", took)
|
||||
}
|
||||
if c.Verdict != Blocked || !strings.Contains(c.Reason, "(already downloading Ohio Players (lidarr))") {
|
||||
t.Errorf("candidate %s: %q", c.Verdict, c.Reason)
|
||||
}
|
||||
|
||||
forced := Candidate{Verdict: Grab, InfoHash: "aaaa", Source: indexer.Result{Magnet: "magnet:?xt=urn:btih:aaaa"}}
|
||||
took = s.Grab(context.Background(), ram, &forced, nil, true, Origin{By: OriginOperator})
|
||||
if took.Added || !strings.Contains(took.Error, "outside Minstrel's category") {
|
||||
t.Errorf("forced: %+v", took)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBetter_QualityThenSeedersThenYear(t *testing.T) {
|
||||
flac := Candidate{Verdict: Grab, Tier: release.TierLossless, Seeders: 2}
|
||||
mp3 := Candidate{Verdict: Grab, Tier: release.TierLossyHigh, Seeders: 90}
|
||||
|
||||
Reference in New Issue
Block a user