Skip to content

Commit 6042fc2

Browse files
committed
fix: try to resolve waiting steps at the end of the main loop
Signed-off-by: Thomas Bétrancourt <thomas@betrancourt.net>
1 parent 4ce3e42 commit 6042fc2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

engine/engine.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ func resolve(dbp zesty.DBProvider, res *resolution.Resolution, t *task.Task, sm
384384
stepChan := make(chan *step.Step)
385385

386386
expectedMessages := runAvailableSteps(dbp, map[string]bool{}, res, t, stepChan, executedSteps, []string{}, wg, debugLogger)
387+
recheckWaiting := true
387388

388389
forLoop:
389390
for expectedMessages > 0 {
@@ -521,6 +522,21 @@ forLoop:
521522
// from candidate resolution states, choose a resolution state by priority
522523
for _, status := range []string{resolution.StateCrashed, resolution.StateBlockedFatal, resolution.StateBlockedBadRequest, resolution.StateError, resolution.StateWaiting, resolution.StateBlockedDeadlock, resolution.StateToAutorunDelayed} {
523524
if mapStatus[status] {
525+
if status == resolution.StateWaiting && recheckWaiting {
526+
for name, s := range res.Steps {
527+
if s.State == step.StateWaiting {
528+
delete(executedSteps, name)
529+
}
530+
}
531+
532+
expectedMessages = runAvailableSteps(dbp, map[string]bool{}, res, t, stepChan, executedSteps, []string{}, wg, debugLogger)
533+
recheckWaiting = false
534+
535+
debugLogger.Debugf("Engine: resolve() %s loop, try to resolve %d waiting step(s)", res.PublicID, expectedMessages)
536+
537+
goto forLoop
538+
}
539+
524540
res.SetState(status)
525541
break
526542
}

0 commit comments

Comments
 (0)