Wait a while
Overview
Wait a While pauses flow execution for a short duration in milliseconds, up to a maximum of 4000ms (4 seconds). Use it for brief pauses between operations. For any delay longer than 4 seconds, use Run Later instead. A value over 4000ms (or a negative value) is rejected: the stage passes immediately with no pause.
Example: Wait a while - setting the "Milliseconds to pause" field to 2000 (2 seconds) before continuing to the next stage.
Where to find it: Flow Control in the stage library.
Configuration
Required Fields
| Field | Description | Example |
|---|---|---|
| Time | Duration in milliseconds to pause execution. Maximum 4000 (4 seconds) | 1000 (1 second), 4000 (4 seconds, the max), {{delayMs}} |
Using functions in these fields: Any value field above accepts @ functions, for example @NowSecond for the current time or @calc(...) for a calculation.
See Flows Functions for the full list.
Exit Points
| Exit | When | Flow Direction |
|---|---|---|
| Pass | Wait duration completed, OR the value was rejected (over 4000ms or negative) | ✓ Flow continues after the delay. If the value was rejected, the flow continues immediately with no pause |
There is only a Pass exit. A rejected value does not route anywhere different: it still passes, just with no pause.
Need a longer delay? Use Run Later. Run Later does not block. The flow continues immediately down the Pass (green) path, while the scheduled action runs later on its own separate path.
How It Works
When executed, Wait a While:
- Resolves time value - Converts static number, variable, or formula to milliseconds
- Pauses current flow - Blocks execution for specified duration
- Returns Pass exit - Continues to next stage after delay completes
Important: This stage blocks the entire flow for the duration. No concurrent processing occurs during the wait.
Common Use Cases
1. Simple Delay
- Time:
1000 - Result: Pause 1 second (1000 milliseconds)
2. Rate Limiting API Calls
- Time:
500 - Flow: Loop → Call API → Wait 500ms → Next iteration
- Result: API calls spaced 500ms apart (max 2 per second)
3. Configurable Retry Delay
- Setup: Set Default Value: retryDelayMs = 2000
- Time:
{{retryDelayMs}} - Flow: Call API → Route Flow (on fail) → Wait → Retry
- Result: Retry with 2-second delay after failure
4. Exponential Backoff
- Time:
={{baseDelay * attempt}} - Flow: Increment attempt → Wait (exponential) → Retry API
- Result: Each retry waits progressively longer (1s, 2s, up to the 4s max)
5. Batch Processing with Delays
- Time:
100 - Flow: Loop → Update database → Wait 100ms → Next record
- Result: Database updates paced to avoid overload
Key Behaviors
| Feature | Behavior |
|---|---|
| Time Unit | Milliseconds (1000 = 1 second) |
| Maximum | 4000ms (4 seconds). Over 4000 or negative is rejected and passes with no pause. Combined wait across all Wait a While stages in a flow also cannot exceed 4 seconds |
| Variable Support | ✓ Accepts variables: {{delayMs}} |
| Formula Support | ✓ Accepts formulas: ={{baseMs * attempt}} |
| Zero Delay | No pause; stage returns immediately |
| Blocking Behavior | Blocks this flow only; other flows unaffected |
| Timeout Interaction | Overall flow timeout may trigger during wait |
Best Practices
- ✓ Use milliseconds: 1000 = 1 second, not 1
- ✓ Use variables for configurable delays:
{{retryDelayMs}} - ✓ Add comments explaining why delay is needed
- ✓ Start with smaller values; the maximum allowed is 4000ms (4 seconds)
- ✓ Use for rate-limiting external API calls
- ✓ Combine with retry logic for robust error handling
- ✓ For any delay longer than 4 seconds, use Run Later instead of Wait a While
Common Mistakes
| Mistake | Symptom | Fix |
|---|---|---|
| Using seconds instead of milliseconds | Entering 4 to mean "4 seconds" actually pauses for only 4 milliseconds | Multiply by 1000 — for a 4-second pause, use 4000 (the maximum allowed) |
| Placing in loop without considering accumulation | Loop with 1s delay × 100 iterations = 100s total | Use smaller delays in loops or batch differently |
| Assuming this handles timeouts | Confusion with timeout settings | Use Call API timeout settings for API timeouts |
| Trying to wait longer than 4 seconds | Value over 4000ms is rejected; the stage passes with no pause at all | Reduce to 4000ms or less, or use Run Later for longer delays |
| Variable not initialized | Error during execution | Use Set Default Value to initialize delay variable first |
Troubleshooting
| Issue | Exit/Result | Common Cause | Fix |
|---|---|---|---|
| Flow doesn't pause at all | Pass (immediate, no delay) | Value over 4000ms or negative, so it was rejected | Reduce to 4000ms or less; for longer delays use Run Later |
| Flow pauses too long | Pass (delayed) | Seconds used instead of ms, but capped at 4000ms | Reduce value or convert to ms (multiply by 1000) |
| Flow doesn't pause | Pass (immediate) | Time = 0 or very small value | Increase milliseconds value (max 4000) |
| Error during wait | Error | Variable not initialized or invalid format | Ensure Time field is numeric or valid variable |
| External system still not ready | Pass | Delay too short | Increase milliseconds; test with target system |
| Performance degraded | Pass (slow) | Long delays in high-volume flows | Reduce delay or batch process differently |
| Flow timeout error | Error | Overall flow timeout triggered during wait | Increase timeout or reduce wait duration |
Edge Cases
- Zero delay (Time = 0): No pause; stage returns immediately
- Value over 4000ms: Rejected. The stage passes immediately with no pause. Attempting to run or test the flow with a static value over 4000 also surfaces an error in the builder
- Negative numbers: Rejected. Same as over-limit: passes immediately with no pause
- Concurrent flows: Only this flow pauses; other flows unaffected
- Variable not initialized: Error during resolution; stage may fail
Related Stages
- Run Later: Schedule delayed execution (vs blocking current flow)
- Loop: Can include waits inside loop (delays accumulate)
- Route Flow: Conditionally decide whether to wait
- Call API: Use API timeout settings for request timeouts