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

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

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.

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 Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free