R-1261: the line hold holds every running seeder, drops the record of an app removed while held, and puts back the qBittorrent slot it held (alternative speed). Red-proved. Commit only.
gates / gates (push) Successful in 1m29s

This commit is contained in:
2026-10-25 20:38:28 +01:00
parent fe9837708a
commit a79a292d72
7 changed files with 475 additions and 88 deletions
@@ -0,0 +1,19 @@
package main
import (
"os"
"strings"
"testing"
)
// R-1261 — a hold of an app removed while held is dropped only if main gives the watch the installed check; without
// it TorrentInstalled is nil, which means „assume installed", and the record waits for an app that never runs again.
func TestR1261_MainWiresTheInstalledCheck(t *testing.T) {
b, err := os.ReadFile("upwatch_wiring.go")
if err != nil {
t.Fatal(err)
}
if !strings.Contains(string(b), "TorrentInstalled: func(stack string) bool") {
t.Fatal("upwatch_wiring.go must wire TorrentInstalled (R-1261)")
}
}
+6 -1
View File
@@ -32,7 +32,12 @@ func newUpwatch(sett *settings.Settings, stackMgr *stacks.Manager, backupMgr *ba
svc := &upwatch.Service{Store: sett, QB: qb, QBRunning: func() bool { return box.Running("qbittorrent") }, QBShare: qbLimitShare,
Measured: line.Measured, Log: logger,
// R-1250: a box that seeds all day is line-tested by holding its torrent app low for one test on request.
Torrents: []upwatch.Holdable{qb, tr}, TorrentRunning: box.Running, LineWaiting: line.Waiting, LineRun: line.Run}
Torrents: []upwatch.Holdable{qb, tr}, TorrentRunning: box.Running, LineWaiting: line.Waiting, LineRun: line.Run,
// R-1261: a hold of an app removed while held is dropped (else the 50 % rule never runs again).
TorrentInstalled: func(stack string) bool {
st, ok := stackMgr.GetStack(stack)
return ok && st != nil && st.Deployed
}}
w := &upwatch.Watcher{
Source: &upwatch.DockerAPI{},
Explainers: map[string]upwatch.Explainer{