mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-02 22:12:18 +02:00
Making promotion materialization-aware only covered `promote_next_download`. Five other sites filled the active slot with `queue.remove(0)` directly, and one of them is the path that actually matters: when a transfer finishes, `finish_active_and_promote` took the next entry blindly. Two users queueing the same film hit exactly that -- the first completes, the second is promoted, and it downloads the same bytes over the file that was just written. The other four are the same shape: retry requeue, capacity-wait requeue, retry-limit-exceeded, and cancelling a paused active recording. Promotion is now one routine, `promote_from_queue`, and every site calls it. Filling the active slot without consulting the attach rule is no longer something a caller can do by accident. The two requeue sites gain something from this beyond consistency: an entry retrying a transfer whose file another entry finished in the meantime now attaches to it rather than retrying a download of bytes that are already on disk. `PromotionDecision::Wait` is documented as unreachable rather than left looking load-bearing. With a single active slot, promotion only runs once that slot is empty, so nothing can be in flight for the same media. It is kept because it is the correct answer if that ever changes.