Use this robust n8n workflow to prevent duplicate processing by centrally managing item states in Redis. Features include automatic troubleshooting links and detailed audit logging.
Download this n8n workflow template and start using it instantly.
Advanced n8n Developers: Users who require high reliability and strict idempotency checks in their automations.
Scalability Engineers: Teams running multiple concurrent n8n workflows that process the same data streams (e.g., webhooks, queues).
When building complex, event-driven processes, a major challenge is preventing the same item from being processed twice. This often occurs when dealing with queue restarts, retries, or multiple simultaneous executions of an n8n workflow.
This utility solves this by providing a centralized, high-speed state management system using Redis. It acts as a single source of truth for all items being processed. Any parent n8n workflow can query the status (check), set a temporary lock (add), or record a final result (update).
A key feature of this specific n8n workflow is its built-in traceability: it automatically captures the execution ID of the calling workflow and generates a direct link for rapid troubleshooting, publishing this information to a Redis channel for real-time audit logging. This dramatically improves the maintainability of your overall n8n solution architecture.
This utility is designed to run as a sub-workflow, triggered by an Execute Workflow n8n node in a parent process.
itemId, action (check, add, update, delete), and the parentExecution context.keyPrefix:itemId:keySuffix) and enforces a default Time-To-Live (TTL).action:inprogress with a short TTL.completedsuccess), often with a much longer TTL.redis-audit-log channel via a Redis Publish n8n node, enabling real-time monitoring by the companion logging n8n workflow.To deploy this state management system, you will need to import the provided n8n workflow JSON twice (if using the audit listener) and configure credentials.
redis-audit-log n8n node. Trigger (from other workflows) (Execute Workflow n8n trigger):
Function: Acts as the entry point, receiving item details (itemId, action) and the execution context (parentExecution) from a calling n8n workflow.
Key Configuration: Defines expected inputs like keyPrefix, itemId, and action to ensure robust inputs.
Set: Context for Response (Set n8n node):
Function: Prepares necessary variables, including calculating the fullKey (e.g., prefix:id:suffix) and setting a default TTL.
Switch Action (Switch n8n node):
Function: Routes the execution flow precisely based on the requested action (check, add, delete, update), ensuring the correct Redis operation n8n node is executed.
Redis: GET (Check Processed) (Redis n8n node):
Function: Used for the check action to query Redis and determine if the item tracking key already exists.
Redis: SET (Add to Processed) / Redis: SET (Update Result) (Redis n8n node):
Function: Sets or updates the item's state in Redis, implementing the temporary lock (add) or recording the final outcome (update).
Code: Prepare Audit Log & Response (Code n8n node):
Function: This crucial custom code n8n node builds the final response payload, generates a detailed audit log entry, and calculates a direct, clickable troubleshootExecutionUrl to the originating n8n workflow execution.
To_redis-audit-log (Redis n8n node - Publish):
* Function: Publishes the structured audit log JSON string to a Redis channel (redis-audit-log), decoupling the logging task from the main execution flow.
Use this robust n8n workflow template utilizing Redis to implement locking mechanisms, preventing concurrent execution of critical automation tasks in your n8n workflows.

Learn how to prepare, clean, and map data fields using the crucial Set n8n node before performing an efficient upsert operation into Google Sheets. This practical n8n workflow demonstrates essential data handling.

Implement a proactive health alert system using a sophisticated n8n workflow. This n8n template analyzes vital signs with GPT-4, calculates dynamic risk scores, and automates urgent notifications via SMS and Slack.

Secure your AI applications against prompt injection and malicious inputs using this advanced, multi-layered GPT-4O security n8n workflow. Includes moderation, sanitization, and quality assurance steps.

Use this powerful n8n workflow template to prevent simultaneous executions of critical workflows using Redis as a distributed locking mechanism. Ensures reliable, sequential n8n automation.

Account Executive by day , Noco builder for fun at night and always a proud dad of Togo the Samoyed.







































