Skip to main content

Prevent duplicate processing with Redis item state tracking

Workflow preview

Workflow preview
100%
Prevent duplicate processing with Redis item state tracking preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

I built this tool because we faced a real, recurring problem: managing hundreds of client projects in a weekly automated loop. There was a time when a single error in that process could create a co...

Best for

  • Engineering automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stopanderror, n8n-nodes-base.set, n8n-nodes-base.redis, n8n-nodes-base.switch, n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.code, n8n-nodes-base.googlesheets, n8n-nodes-base.redistrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Stephan Koning.

Original n8n.io source

1.1 Workflow description

Title
Prevent duplicate processing with Redis item state tracking
Workflow name
Prevent duplicate processing with Redis item state tracking

I built this tool because we faced a real, recurring problem: managing hundreds of client projects in a weekly automated loop.

There was a time when a single error in that process could create a complete data mess, forcing us to manually clean and re-run everything. The Item Tracker was our solution.

It proved that something simple, when used correctly, can be a game-changer for maintaining order and reliability in your workflows (at least it was for us).


How the System Works: A Story of Order from Chaos

Our main automation, which fetches and summarizes data, is where the heavy lifting happens. But its newfound stability comes from a simple, critical collaboration with the Item Tracker. It's like a two-step handshake that happens for every single project.

  • Our main workflow starts by getting a long list of active projects.
  • For each project, it first asks the Item Tracker: "Is this one already being worked on?"
  • If the answer is no, the Item Tracker immediately puts a temporary "in-progress" note on the project
  • Once our main workflow successfully completes its task for that project, it tells the Item Tracker to remove the "in-progress" note and set a "completed" note.

This simple process is our safety net. If a task fails, that "in-progress" note will eventually disappear, allowing the system to confidently pick up and re-run only that specific item later. ++This saves us from having to start the entire job over from scratch.++

Key Components & Their Purpose

  • Main Workflow: This is the primary automation that does the heavy lifting, like getting a list of projects and connecting to HubSpot.
  • Item Tracker Utility: The smart part of the system. This separate tool keeps a simple record of what each project's status is at any given moment.
  • Redis Database: This is the fast, central hub where all of the Item Tracker's notes are stored. It's the engine that makes the entire system reliable.

The Item Tracker in Action: Your Digital To-Do List

For beginners, the names of the tracking notes (called "keys") might seem confusing, but the idea is actually simple. Imagine a digital to-do list for every project. A key is just the project's name on that list.

Every key has three parts that tell you everything you need to know:

  • The Group: The first part groups all similar items together, like all your HubSpot projects.
  • The ID: The middle part is the project's unique ID, so you know exactly which project you're talking about.
  • The Status: The last part is a simple word that shows its status, like in_progress or completed.

This simple naming system is the secret to keeping hundreds of projects organized, so you can easily see what's happening and what needs attention.


Overall Business Value

This solution directly addresses the pain of large-scale automation failures. It gave us a new level of confidence in our automated processes. Instead of facing the chaos of a messy run, this system provides immediate visibility into which project failed and why. It eliminates the need for manual cleanup and allows us to confidently re-run a specific item without risking data corruption across the entire set. The result is a highly reliable and scalable process that saves time, reduces frustration, and maintains data integrity.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Handle Invalid Action

Type / Role
n8n-nodes-base.stopAndError - stopAndError
Config choices
Version 1

Block 2 - Set CHECK Output

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Set ADD Output

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 4 - Redis: GET (Check Processed)

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 5 - Redis: SET (Add to Processed)

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 6 - Switch Action

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 7 - Trigger (from other workflows)

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 8 - Redis: DELETE (Untrack Item)

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 9 - To_redis-audit-log

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 10 - Set DELETE Output

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 11 - Code: Prepare Audit Log & Response

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 12 - Set: Context for Response

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 13 - Redis: SET (Update Result)2

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 14 - Set UPDATE Output2

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 15 - Parse Log Message

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - redis-audit-log

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.1

Block 17 - On new Redis event

Type / Role
n8n-nodes-base.redisTrigger - redisTrigger
Config choices
Version 1

Block 18 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Prevent duplicate processing with Redis item state tracking
Complexity advanced
Nodes 21
Categories Engineering
Author Stephan Koning
Published 02 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6828/6828.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Prevent duplicate processing with Redis item state tracking do?

I built this tool because we faced a real, recurring problem: managing hundreds of client projects in a weekly automated loop. There was a time when a single error in that process could create a co...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering use case.