Any plans to add a way to wait for an outside event? an alternative right now would be to make a nor

Any plans to add a way to wait for an outside event? an alternative right now would be to make a normal step with a very high retry limit and a constant backoff and fail it everytime if some condition isn't met, but that seems wasteful.

Another hack to achieve this is to pause the workflow once it reaches a certain step, then resume it once some condition is met and a value is set somewhere so that the workflow can retrieve that value and continue its execution.

But some API like this would be way more efficient with a far better DX:
// Inside the workflow (Maybe it could have some timeout option to fail the workflow if the event never comes within a timeframe)
const payload = await step.waitFor("event_name", "10 minutes")

// And outside the workflow, having the ability to check what event is being waited on would be great to avoid race conditions leading to stuck workflows
if("event_name" === await workflowInstance.waitedOnEvent()){
    await workflowInstance.send("event_name", /* Optional payload */)
}

// And for events that we just want to queue for whenever they come up and don't care that the workflow will start waiting for them we can simply send them
// This would be useful for cases where multiple webhook events that we are interested in might come out of order so that we wouldn't need to care about when we send them to the workflow
await workflowInstance.send("some_event", /* Optional payload */)
Was this page helpful?