Prevent Concurrent n8n Workflow Runs Using Redis Locking

Avoid costly overlapping executions in n8n workflows by using Redis to lock and track workflow status. This automation prevents duplicate runs with a Redis-based locking mechanism to save time and reduce errors.
redis
executeWorkflow
switch
+8
Workflow Identifier: 2142
NODES in Use: Execute Workflow Trigger, Switch, Manual Trigger, If, Sticky Note, Execute Workflow, Redis, Set, Stop and Error, No Operation, Wait
Prevent Concurrent n8n Workflow Runs with Redis

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Workflow Does

This workflow prevents multiple runs of the same process at the same time in n8n.

It uses Redis to check if a lock exists, block new runs if needed, and release the lock when done.

This stops data problems caused by overlapping workflow triggers.


Who Should Use This Workflow

People running workflows that must not run more than once at a time.

Users with processes that update orders or inventory and need to avoid errors from racing runs.

This is good for automations that may start again before finishing.


Tools and Services Used

  • n8n: For workflow automation and orchestration.
  • Redis: Stores locking keys and states with expiry times.
  • Execute Workflow Trigger node: Receives external commands to control lock actions.
  • Switch node: Routes execution by action type (get, set, unset).
  • If node: Checks if lock exists before proceeding.
  • Stop and Error node: Stops execution with error if lock found.
  • Wait node: Simulates long steps and state changes.

Inputs, Processing Steps, and Outputs

Inputs

  • Action: Controls lock step (get, set, unset).
  • Key: Unique identifier for the workflow instance.
  • Value: Lock status text like “working” or stage names.
  • Timeout: Lock expiry time in seconds.

Processing Steps

  • Check Redis if key exists (get action).
  • If key exists, stop the workflow with an error.
  • If key missing, set the lock key with value and timeout.
  • Run workflow steps simulating progress states (started, loading, finishing).
  • Unset the lock key to free for future runs.

Outputs

  • Either error indicating workflow is running, or normal successful run with lock progress.
  • Redis keys track workflow status for visibility and debugging.

Beginner Step-by-Step: How to Use This Workflow in n8n

Importing the Workflow

  1. Download the workflow JSON file using the Download button on this page.
  2. Open your n8n editor and select “Import from File”.
  3. Choose the downloaded file to load the workflow into n8n.

Configuring Credentials and Settings

  1. Add your Redis credentials inside n8n under Settings → Credentials.
  2. Check if any node requires updating IDs, emails, or channels and change as needed.
  3. Review the Set Timeout node to adjust the lock timeout (default 600 seconds) if needed.

Testing and Activating

  1. Run the workflow manually once to make sure locking and unlocking works as expected.
  2. If successful, activate the workflow to let it run automatically or triggered by your events.
  3. Monitor executions in n8n logs and Redis keys using CLI or dashboard.

This method works well whether using cloud or self-host n8n setups.


Customization Ideas

  • Change the timeout value in Set Timeout to fit your workflow’s longest run time.
  • Add workflow names or IDs inside Redis keys for better tracking when many workflows use this lock system.
  • Extend status values to include more detailed progress states like “started”, “loading”, “finishing”.
  • Modify Stop and Error node messages to notify users via Slack or email.
  • Use different Redis keys to separate locks for different workflow processes.

Edge Cases and Troubleshooting

  • Redis Connection Errors: Check credentials and network access if nodes fail to connect.
  • Lock Not Releasing: Make sure Unset Key node always runs; use TTL as a fallback.
  • Workflow Always Shows “Already Executing”: Verify lock key expiry and proper unlock logic.

Use Redis CLI commands to inspect keys directly to debug locks.


Summary

✓ Prevent multiple runs to avoid data errors.

✓ Use Redis keys with TTL as workflow locks.

✓ Automatically stop new runs if a process is running.

→ Clear status tracking of workflow steps.

→ Save time fixing overlapping execution problems.

Prevent Concurrent n8n Workflow Runs with Redis

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Check Redis host, port, and password credentials in n8n settings. Verify network access to Redis server.
Ensure the Unset Key node runs every time, even on errors. Use a TTL expiration as a safety fallback.
Redis supports high throughput, but extreme concurrency may need infrastructure tuning beyond this workflow.
Download the workflow file, import it inside n8n editor, add Redis credentials, update any IDs, test the workflow, then activate.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.