Skip to content

Commit 571cba7

Browse files
author
Michal Tichák
committed
[core] part of OCTRL-1076, proper error handling in eventloop
1 parent 8eb6755 commit 571cba7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

executor/eventloop.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ func eventLoop(state *internalState, decoder encoding.Decoder, h events.Handler)
6969
case e := <-eventCh:
7070
log.Trace("EVENT LOOP about to handle event")
7171
err = h.HandleEvent(ctx, &e)
72+
// if we get an error here we are stoping the eventloop before triggering another nextEventNotify
73+
// so it won't get stuck on eventCh, errorCh
74+
if err != nil {
75+
break
76+
}
7277

7378
// Spawn a goroutine to wait for the next event
7479
go nextEventNotify(decoder, eventCh, errorCh)
@@ -100,7 +105,7 @@ func sendFailedTasks(state *internalState) {
100105
delete(state.failedTasks, taskID)
101106
// If there aren't any failed and active tasks, we request to shutdown the executor.
102107
if len(state.failedTasks) == 0 && len(state.activeTasks) == 0 {
103-
//Originally state.shouldQuit = true but we want to keep the executor running
108+
// Originally state.shouldQuit = true but we want to keep the executor running
104109
log.WithField("executorId", state.executor.ExecutorID).Info("task failure notified, no tasks present on executor")
105110
}
106111
}

0 commit comments

Comments
 (0)