Skip to content

Commit

Permalink
Fix init loop in engine.go (#12794)
Browse files Browse the repository at this point in the history
Once initSuccessful got set to false, it never got re-set back to true.

Co-authored-by: Cedric <[email protected]>
  • Loading branch information
bolekk and cedric-cordenier authored Apr 12, 2024
1 parent f2963a6 commit 7d25d5a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/services/workflows/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ func (e *Engine) init(ctx context.Context) {
ticker := time.NewTicker(time.Duration(retrySec) * time.Second)
defer ticker.Stop()

initSuccessful := true
LOOP:
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
initSuccessful := true
// Resolve the underlying capability for each trigger
for _, t := range e.workflow.triggers {
tg, err := e.registry.GetTrigger(ctx, t.Type)
Expand All @@ -82,9 +82,11 @@ LOOP:
e.logger.Errorf("failed to get trigger capability: %s, retrying in %d seconds", err, retrySec)
continue
}

t.trigger = tg
}
if !initSuccessful {
continue
}

// Walk the graph and register each step's capability to this workflow
err := e.workflow.walkDo(keywordTrigger, func(s *step) error {
Expand Down

0 comments on commit 7d25d5a

Please sign in to comment.