⚒️ Prevent concurrent workflow runs using Redis

925 views · ⚒️ Engineering

Description

What does this template do?

This workflow sets a small “lock” value in Redis so that only one copy of a long job can run at the same time. If another trigger fires while the job is still busy, the workflow sees the lock, stops early, and throws a clear error. This protects your data and keeps you from hitting rate limits.
Because the workflow also stores simple progress flags (“working”, “loading”, “finishing”), you can poll the current status and show live progress for very long jobs.

Use Case

Great when the same workflow can be called many times in parallel (for example by webhooks, cron jobs, or nested Execute Workflow calls) and you need an “only run once at a time” guarantee without building a full queue system.

What the Workflow Does

Apps & Services Used

Pre‑requisites

Customization Tips

Additional Use Cases

🛑 Telegram callback spam filter

If a Telegram bot sends many identical callbacks in a burst, call this workflow first to place a lock. Only the first callback will proceed; the rest will exit cleanly until the lock clears. This keeps your bot from flooding downstream APIs.

🧩 External API rate‑limit protection

Run heavy API syncs one after the other so parallel calls do not break vendor rate limits.

🔔 Maintenance window lock

Block scheduled maintenance tasks from overlapping, making sure each window finishes before the next starts.

🔗 Nodes Used

Redis, Execute Sub-workflow, Stop and Error, Execute Workflow Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup