UnblockFailed needs to untrack the job
This commit is contained in:
parent
d935e78ca9
commit
b1c2a9ddb9
|
@ -336,6 +336,7 @@ func (b *BlockedEvals) UnblockFailed() {
|
||||||
if eval.TriggeredBy == structs.EvalTriggerMaxPlans {
|
if eval.TriggeredBy == structs.EvalTriggerMaxPlans {
|
||||||
unblock = append(unblock, eval)
|
unblock = append(unblock, eval)
|
||||||
delete(b.captured, id)
|
delete(b.captured, id)
|
||||||
|
delete(b.jobs, eval.JobID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,10 +344,15 @@ func (b *BlockedEvals) UnblockFailed() {
|
||||||
if eval.TriggeredBy == structs.EvalTriggerMaxPlans {
|
if eval.TriggeredBy == structs.EvalTriggerMaxPlans {
|
||||||
unblock = append(unblock, eval)
|
unblock = append(unblock, eval)
|
||||||
delete(b.escaped, id)
|
delete(b.escaped, id)
|
||||||
|
delete(b.jobs, eval.JobID)
|
||||||
|
b.stats.TotalEscaped -= 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
b.evalBroker.EnqueueAll(unblock)
|
if l := len(unblock); l > 0 {
|
||||||
|
b.stats.TotalBlocked -= l
|
||||||
|
b.evalBroker.EnqueueAll(unblock)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDuplicates returns all the duplicate evaluations and blocks until the
|
// GetDuplicates returns all the duplicate evaluations and blocks until the
|
||||||
|
|
|
@ -404,6 +404,12 @@ func TestBlockedEvals_UnblockFailed(t *testing.T) {
|
||||||
// Trigger an unblock fail
|
// Trigger an unblock fail
|
||||||
blocked.UnblockFailed()
|
blocked.UnblockFailed()
|
||||||
|
|
||||||
|
// Verify UnblockFailed caused the eval to be immediately unblocked
|
||||||
|
blockedStats := blocked.Stats()
|
||||||
|
if blockedStats.TotalBlocked != 0 && blockedStats.TotalEscaped != 0 {
|
||||||
|
t.Fatalf("bad: %#v", blockedStats)
|
||||||
|
}
|
||||||
|
|
||||||
testutil.WaitForResult(func() (bool, error) {
|
testutil.WaitForResult(func() (bool, error) {
|
||||||
// Verify Unblock caused an enqueue
|
// Verify Unblock caused an enqueue
|
||||||
brokerStats := broker.Stats()
|
brokerStats := broker.Stats()
|
||||||
|
|
Loading…
Reference in New Issue