engine: graph: Don't deadlock on error

This simplifies the pause mechanism and also avoids a deadlock on error.
If the Worker shuts down completely, but before we've been removed from
the graph, then an attempted pause would deadlock if we didn't have an
escape hatch here.

This removes the unnecessary ack mechanism now that we have a
synchronous channel send to represent the pausing, rather than an
asynchronous channel closing.
This commit is contained in:
James Shubin
2023-09-01 16:50:54 -04:00
parent 2773a621a2
commit 0b1b0a3f80
2 changed files with 3 additions and 15 deletions

View File

@@ -412,7 +412,7 @@ Loop:
// being made safe with a sync.Once, we instead run a
// close() call inside of the vertexRemoveFn function,
// which should unblock resumeSignal so we can shutdown.
obj.state[vertex].pausedAck.Ack() // send ack
// we are paused now, and waiting for resume or exit...
select {
case _, closed = <-obj.state[vertex].resumeSignal: // channel closes