fix(worker): smarter Soulseek peer selection + stall/progress-aware transfers
Draining the queue via Soulseek was stalling: slow peers (~100KB/s) never finished a full FLAC album within the fixed 10-min timeout, got cancelled at ~89%, and the fall-through restarted from scratch on the next peer — while single-song folders named like the album were also being tried. - Stall detection: abandon a peer with no byte progress for ~90s (queued/dead) instead of waiting the full timeout; a peer that IS progressing keeps its slot up to a 60-min backstop, so a slow-but-working transfer can finish. - Rank search candidates by peer: free upload slot, then speed, then shortest queue. - Drop candidates with far fewer tracks than the release (single-song folders) up front, so no download attempt is wasted on them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -395,6 +395,12 @@ def run_pipeline(
|
||||
for adapter, results in per_adapter:
|
||||
for c in results:
|
||||
found.append(replace(c, source_tier=adapter.tier, confidence=score_confidence(target, c)))
|
||||
# Drop candidates that can't be the full album — a result with far fewer tracks than the release
|
||||
# has (e.g. a single-song Soulseek folder named like the album). Same threshold as the
|
||||
# completeness 'too small' guard, applied up front so we never waste a download attempt on it.
|
||||
# Unknown counts (0) and legitimately smaller editions (e.g. 11 vs 12) are kept.
|
||||
if target.track_count:
|
||||
found = [c for c in found if c.track_count == 0 or c.track_count * 2 > target.track_count]
|
||||
_persist_candidates(conn, job_id, found)
|
||||
|
||||
# Qobuz pacing: when the budget gate is closed (off-hours / daily cap / spacing), drop Qobuz
|
||||
|
||||
Reference in New Issue
Block a user