n8n

How to Automate Redis Locked Job Scheduling?

Run your main job on a timer without overlap. A Redis flag works like a lock so only one run happens at a time. Great for long imports, data syncs, and reports that should never double run.

A Schedule Trigger checks every few seconds and reads a status key in Redis. If the key shows idle or is missing, the flow marks it as running, starts the target workflow by ID, and waits for it to finish. When the called job ends, the status flips back to idle. If the key says running, the flow stops early so no duplicate run begins. The status key uses a dynamic name so each workflow controls its own lock. A manual reset path lets you switch the flag back to idle after an outage.

Setup is simple. You need a Redis account and an n8n project. Set your timer interval, enter the ID of the workflow you want to run, and connect the Redis credential. The default interval is 5 seconds but you can change it to fit your load. Expect clean single run behavior, fewer data mistakes from duplicate work, and quick recovery with one click reset. Use it for nightly imports, batch updates, inventory syncs, or any job that must not overlap.

What are the key features?

  • Schedule Trigger runs on an adjustable interval set to 5 seconds by default
  • Redis Get reads a dynamic status key named workflowStatus_{{ $workflow.id }}
  • If and Filter nodes allow runs only when the status is idle or missing
  • Redis Set marks the status as running before the main job starts
  • Execute Workflow starts the target workflow by its ID and waits for completion
  • Redis Set switches the status back to idle after the run finishes
  • Manual Trigger with Reset to Idle supports fast recovery after outages
  • No Operation node safely ends the flow when a run is already in progress

What are the benefits?

  • Eliminate 100 percent of overlapping scheduled runs
  • Reduce manual restarts from 30 minutes to 2 minutes with one click reset
  • Improve data quality by preventing duplicate processing errors
  • Handle more scheduled work safely by gating runs with Redis
  • Connect n8n and Redis without writing code

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Redis. See the Tools Required section above for links to create accounts with these services.
  3. Create or identify the main workflow you want to run on a schedule. Copy its workflow ID from the n8n editor URL or the workflow settings.
  4. Open the Execute Workflow node and paste your main workflow ID into the workflowId field.
  5. Set up Redis. Get your host, port, password, and TLS settings from your Redis provider or server.
  6. In the n8n credentials manager, create a new Redis credential. If unsure, double click any Redis node, choose Create new credential in the Credential to connect with dropdown, and follow the on screen instructions.
  7. Assign the same Redis credential to all Redis nodes: Get Status, Set Running, Set Idle, and Reset to Idle.
  8. Adjust the Schedule Trigger interval to match your needs. The default is every 5 seconds. Use a longer interval for heavier jobs.
  9. Enable the workflow and run a test. Start a long job in your target workflow and confirm that a second run does not start while the first is still running.
  10. Check the Redis key workflowStatus_{{ $workflow.id }} with a Redis client. It should show running during execution and idle when done.
  11. If a crash leaves the status stuck on running, disable the schedule, use the Manual Trigger path, run Reset to Idle, then re enable the schedule.
  12. If nothing runs, verify Redis network access, credentials, and TLS settings. Confirm the Execute Workflow node has the correct workflow ID.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Redis

Sign up

Free plan: $0 / mo, 30 MB, single DB

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.