Delay (Scheduled pause)
Description
Section titled “Description”The Delay node halts a workflow for a configured amount of time (seconds, minutes, hours, or days) and resumes execution automatically when the deadline is reached, continuing from the next configured node. Unlike a blocking sleep, the Delay frees the server process during the wait: the state is persisted to the database and the workflow resumes in a new process when the scheduled time arrives.
The execution trace is continuous: nodes run before and after the delay appear in the same instance history.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
delayAmount | Number | Yes | How long to wait |
delayUnit | Select | Yes | Unit: seconds, minutes, hours, days |
nextModule | Module | Yes | Node that will execute when the delay expires |
How it works
Section titled “How it works”- The node calculates the exact resume date/time (
now + delayAmount × delayUnit). - Persists the continuation state in the
workflow_delaystable withstatus = waiting. - Schedules a
node-schedulejob for that date. - Returns
_stopflowprocess: trueto the engine, which pauses the flow and releases the execution slot. - When the job fires,
continueWorkflowAfterDelaycalls the engine with the same instanceworkflow_idand the next node as the entry point. - The engine detects the instance already exists, loads the steps recorded before the delay from the DB, and pre-populates the trace array — ensuring full session continuity.
Recovery after server restarts
Section titled “Recovery after server restarts”If the server restarts while delays are pending, DelayMonitorService restores them automatically on startup: it reschedules jobs whose execution date has not yet passed and immediately executes any that expired during downtime.
workflow_delays table
Section titled “workflow_delays table”CREATE TABLE workflow_delays ( id INT AUTO_INCREMENT PRIMARY KEY, workflow_id VARCHAR(255) NOT NULL, client_id INT NOT NULL, next_module VARCHAR(255) NOT NULL, continuation_data TEXT NOT NULL, scheduled_at DATETIME NOT NULL, delay_node_id VARCHAR(255) NOT NULL, status ENUM('waiting', 'executed', 'error', 'cancelled') DEFAULT 'waiting', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, executed_at TIMESTAMP NULL, error_message TEXT NULL, UNIQUE KEY unique_workflow_delay (workflow_id, delay_node_id));Output while waiting
Section titled “Output while waiting”When the Delay node activates, it immediately returns this object to the engine (the flow stops here):
{ "nextModule": null, "_stopflowprocess": true, "_meta_": { "delayScheduled": true, "executeAt": "2025-06-10T14:30:00.000Z", "jobName": "delay_wf_abc123_nodeId" }, "data": { "...": "flow data", "delayInfo": { "scheduledAt": "2025-06-10T14:30:00.000Z", "delayAmount": 30, "delayUnit": "minutes", "status": "scheduled" } }}Possible errors
Section titled “Possible errors”| Code | Description |
|---|---|
MISSING_TABLE | The workflow_delays table does not exist in the database |
INVALID_TABLE_STRUCTURE | The table exists but is missing required columns |
INVALID_DELAY_AMOUNT | delayAmount is not a positive number |
INVALID_DELAY_UNIT | delayUnit is not one of the allowed values |
MISSING_NEXT_MODULE | No next node was configured |
INVALID_EXECUTION_TIME | The calculated date is already in the past |
SCHEDULE_ERROR | Internal error scheduling the job |
Usage examples
Section titled “Usage examples”Retry an HTTP call after 5 minutes
Section titled “Retry an HTTP call after 5 minutes”{ "delayAmount": 5, "delayUnit": "minutes"}Wait 1 day before sending a follow-up email
Section titled “Wait 1 day before sending a follow-up email”{ "delayAmount": 1, "delayUnit": "days"}Separate two processing batches by 30 seconds
Section titled “Separate two processing batches by 30 seconds”{ "delayAmount": 30, "delayUnit": "seconds"}- The workflow does not hold an execution slot during the pause; other workflows run normally.
- If the same
workflow_id+delay_node_idpair already has a registered delay,INSERT ... ON DUPLICATE KEY UPDATEreplaces the previous record (the prior job is cancelled and a new one is created). - The data flowing through the pipeline is serialized as JSON in
continuation_dataand restored on resume. - The full trace (nodes before and after the delay) is visible in the instance history.
Related nodes
Section titled “Related nodes”- SubWorkflow — executes a child flow synchronously while maintaining session linkage
- Iterator — splits an array into batches and processes them sequentially or in parallel