Sequential or queue-like use of multiple n8n execution that run at the same time

Describe the problem/error/question

Hi!

Sorry for distubing you but I cant find the answare to a question relatetd to sequential workflow execution in n8n cloud. I tried browsing, asking AI, posting on the Forum but no results.

Could you please read this post in the link or search on the forum for my post titled How to Ensure Sequential Workflow Execution in n8n to Avoid Data Overwriting?

I would be forever grateful if you could help me, or give me any advice, or at least tell me if there is somebody who coul help.

Thanks and have a wonderful day.

Please share your workflow

Information on your n8n setup

  • n8n version:1.107.3
  • Database (default: SQLite)
  • n8n EXECUTIONS_PROCESS setting (default: own, main)
  • Running n8n via: cloud
  • Operating system:Windows 10

What currently error/case that you caught?
I need to know it first, maybe I can help you.

As you can see from the original post from the link, there is no error. The problem is because both executions start at the same time, when i get rows from sheets, they get the same row modify it in different ways, and when they append them, one overwrites the other. Basically one should be finished, before the other one gets to the node that retrieves the row. Thats why i was thinking that maybe a queue would solve the problem, or maybe a MUTEX ( A mutex, short for mutual exclusion, is a synchronization primitive used in concurrent programming to control access to shared resources. It prevents multiple threads or processes from accessing the same data or code simultaneously, which could lead to data corruption or unexpected behavior. Essentially, a mutex acts like a lock that allows only one thread at a time to “own” the resource, ensuring exclusive access). But this can usually be done at a hard level.

Easiest way is to use a queue of some kind. I prefwr to use rabbitMQ because of the nice native nodes available.

The trigger node can be set to run 1 in parallel.

2 Likes

Can rabbitMQ be used in cloud version of n8n? Doesn’t it need to be installed on a system to function?

No it would need an external rabbitmq. Probably cloud offerings for those as well

1 Like

I have solved my problem by using rabbitMQ, at the moment this seems to be the only way to ensure a sequential execution of a workflow / creating concurrency for executions in a workflow. It can even be done in cloud, just host your rabbiyMQ using some free provider (in my case CloudAMQP) and it’s all done, only thing is that you will need to saparate your original workflow in two: a workflow that takes from your webhook or other trigger data and pushes it in the queue, and the rest of the original workflow now starts with the rabbitMQ trigger, that activates for each entry in the queue.

1 Like

Here are the two workflows that glued together make my original workflow:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.