diff --git a/nomad/blocked_evals.go b/nomad/blocked_evals.go index 1209c548c70..8f5a6f5c4c7 100644 --- a/nomad/blocked_evals.go +++ b/nomad/blocked_evals.go @@ -316,15 +316,17 @@ func (b *BlockedEvals) UnblockFailed() { } var unblock []*structs.Evaluation - for _, eval := range b.captured { + for id, eval := range b.captured { if eval.TriggeredBy == structs.EvalTriggerMaxPlans { unblock = append(unblock, eval) + delete(b.captured, id) } } - for _, eval := range b.escaped { + for id, eval := range b.escaped { if eval.TriggeredBy == structs.EvalTriggerMaxPlans { unblock = append(unblock, eval) + delete(b.escaped, id) } } diff --git a/nomad/worker_test.go b/nomad/worker_test.go index 840ea1a28e4..52b557bba6e 100644 --- a/nomad/worker_test.go +++ b/nomad/worker_test.go @@ -466,13 +466,8 @@ func TestWorker_ReblockEval(t *testing.T) { t.Fatal(err) } - // Enqueue the eval - testutil.WaitForResult(func() (bool, error) { - err := s1.evalBroker.Enqueue(eval1) - return err == nil, err - }, func(err error) { - t.Fatalf("err: %v", err) - }) + // Enqueue the eval and then dequeue + s1.evalBroker.Enqueue(eval1) evalOut, token, err := s1.evalBroker.Dequeue([]string{eval1.Type}, time.Second) if err != nil { t.Fatalf("err: %v", err)