Skip to content

Commit

Permalink
Remove select
Browse files Browse the repository at this point in the history
  • Loading branch information
Kien Nguyen authored and vtdat committed Jul 28, 2020
1 parent 506c2df commit 9a5a85e
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions pkg/autohealer/wflexectracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,29 @@ outerloop:
fmt.Sprintf("Execution %d of workflow", tracker.numRetried),
"workflow", tracker.mistralAct.WorkflowID, "execution", tracker.execution.ID)
for {
select {
case <-ticker.C:
exec, err := alert.GetExecution(tracker.os, tracker.execution.ID)
if err != nil {
level.Error(tracker.logger).Log("msg", "error while getting execution state",
"err", err)
continue
}
tracker.execution = exec
if exec.State == WorkflowExecutionErrorState {
level.Debug(tracker.logger).Log("msg", "execution in error state",
"execution", tracker.execution.ID)
time.Sleep(DefaultMistralActionRetryDelay* time.Second)
continue outerloop
}
if exec.State == WorkflowExecutionSuccessState {
return nil
}
<-ticker.C
exec, err := alert.GetExecution(tracker.os, tracker.execution.ID)
if err != nil {
level.Error(tracker.logger).Log("msg", "error while getting execution state",
"err", err)
continue
}
tracker.execution = exec
if exec.State == WorkflowExecutionErrorState {
level.Debug(tracker.logger).Log("msg", "execution in error state",
"execution", tracker.execution.ID)
time.Sleep(DefaultMistralActionRetryDelay * time.Second)
continue outerloop
}
if exec.State == WorkflowExecutionSuccessState {
return nil
}
}
}
}

func (tracker *WFLExecTracker) executeWFL() error {
tracker.numRetried += 1
tracker.numRetried++
if tracker.numRetried > tracker.maxRetries {
level.Debug(tracker.logger).Log("msg", "Retried workflow executions exceeds maxRetries",
"workflow", tracker.mistralAct.WorkflowID)
Expand Down

0 comments on commit 9a5a85e

Please sign in to comment.