[Feature Request] Await multiple signals in a workflow
jacek-rzrz opened this issue · comments
Is your feature request related to a problem? Please describe.
Following this, we are trying to implement a wait for multiple signals in a Temporal Workflow. It seems that the JVM SDK has Workflow.await
suited exactly for this purpose, is there a similar tool in Typescript?
Describe the solution you'd like
Expressing our workflow e.g. like this:
Workflow.wait(() -> allSignalsReceived());
Additional context
So far we have managed to implement this as a while
loop:
while(true) {
if(allSignalsReceived()) {
break;
}
await workflow.sleep(1000);
}
The above implementation is causing OutOfMemory
issues for the workers, we understand this is because every iteration of the unbounded loop is getting cached. We understand we might be able to resolve the memory issues with workflow.continueAsNew
or by drastically reducing the maxCachedWorkflows
param, but neither of these options seem like a production-grade solution.
Closing - turns out there is workflow.condition
for this exact purpose already!