I have a workflow will sometimes wait for an approval from a user before proceeding. This approval can occur at a point indefinitely in the future.
My concern is that this will cause a hanging thread in my program, I don’t want resource on my server to be consumed while I wait for an approval or a message from a signal channel.
After reading all the documentation, it is unclear to me if functions like .Receive()
or .ReceiveAsync()
will block the thread, consuming resource, or will put the workflow to sleep and just restart it when a signal is received.
I have some code that looks like this, should I be using a timer, sleep
or workflow.Await()
to ensure this thread doesn’t hang while it waits for channels?
for {
var completed bool
ok := completionChannel.ReceiveAsync(&completed)
if !ok {
if len(executionDAG.queuedRevisionNodes) == 0 {
break
}
}
}