Someone signs up for your app. One second later, the workflow asks for their promotions and gets nothing back.
Nothing is broken. The workflow just asked too early. The new account was still being set up behind the scenes, so the promotions couldn't find it yet. Ask again three seconds later and they show up.
A wait step is how you fix that. It tells the workflow to pause for a moment, then carry on.
Why not just sleep?
A three-second pause is easy anywhere. The harder cases are the long ones. A review period that lasts two days. A report that can only run after the quarter closes. A trading window that opens next Monday.
You don't want a process sitting in memory for two days, or an engineer setting a reminder to trigger the next step. You want the workflow to pause, keep its place, and pick up on its own when the time comes.
Three reasons to wait
- Let a system catch up. Indexing, replication, a downstream job that needs a moment. The pause removes a whole class of ""it worked on the second try"" bugs.
- Wait for a date. The first of January for annual processes, the end of a financial quarter for reporting, the start of a trading window.
- Respect a required delay. Approval flows with a mandatory review period, settlements with a clearing time, compliance steps that mandate a waiting window.
In all three, time is part of the business logic, not a technical detail.
How it works in Unmeshed
The wait step is a built-in task. You drag it between two steps and give it a small piece of JavaScript that decides how long to wait. The code returns a field called waitUntil, which is a timestamp in epoch milliseconds. Until that moment, the workflow stays paused. After it, the next step runs.
For the signup example, the wait is the step's own start time plus three seconds. For a fixed date, you return that date's timestamp instead. The same step covers both, because it only cares about the moment to resume.
What you get for it
The wait lives inside the workflow, so you don't need an outside scheduler or a cron job to trigger the next step, and nobody has to rerun anything by hand. It also stays visible. You can open a run and see that it's waiting, and until when, instead of wondering whether it's stuck.
Real processes rarely happen all at once. If yours include a pause, whether it's a few seconds or a few months, model it as a step. Unmeshed lets you handle time the same way you handle API calls."
Top comments (0)