fix(batch): recover incomplete startup discovery without rerunning jobs

Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
Feng Ruohang
2026-11-07 02:35:15 +08:00
parent 00270e9f61
commit 41b71a8bc1
4 changed files with 312 additions and 15 deletions
+5 -1
View File
@@ -98,7 +98,7 @@ func TestBatchPluginPauseRecoversInProcess(t *testing.T) {
}
unavailable.Store(false)
pool.retryDue(time.Now().Add(time.Hour))
waitBatchState(t, pool, job.ID, "")
waitBatchState(t, pool, job.ID, "terminal")
ri = f.jobInfo(t, job)
if !ri.Complete || ri.Failed || ri.PausedReason != "" || ri.Objects != 1 || f.versionExists(t, "data/key", older) {
t.Fatalf("resumed report: %+v", ri)
@@ -149,6 +149,10 @@ func TestBatchPoolOwnershipAndCancellation(t *testing.T) {
t.Fatal("first not owned")
}
pool.finishJob(first, nil)
mustIAM(t, pool.queueJob(&BatchJobRequest{ID: first.ID}))
if len(pool.jobCh) != 0 {
t.Fatal("late discovery re-admitted a terminal job")
}
pool.retryDue(time.Now())
next := <-pool.jobCh
if next != second || !pool.beginJob(next) {