Order of execution among nodes

Hey Everyone,
Thanks for this awesome tool.
I understand that implementation of n8n makes executions go in a serial fashion, but what about branching.
if I have a workflow A->B->{C,D,E}
C,D,E are separate branches. I understand that they won’t be executing in parallel, but how is order decided, would C be taken up first or E?

1 Like

Welcome to the community @feregi2 and great to hear that you enjoy n8n!

The execution order is in the order you did connect them. So the node you did connect first, will be executed first, the one you connected second after that and so on.

2 Likes

Here is a small visualization of what you’re trying to say.

When this thing is practically implemented it’ll be in the order of what you connected first.

image

Let’s say I have workflow and it has a branch. I saw the branch will be executed first and the following workflow will be the next one.

In the Below case, Dropbox node will execute first then the rest of workflow will be continued (I have seen this when I manually execute the workflow)

Haha, It’s really cool to watch that icon spinning inside the nodes :laughing:

6 Likes

@feregi2, I curious what motivated your question. I guess you have a use case where the execution order matters. Would you mind sharing what you’re trying to do?

2 Likes

Hey there,

I am using n8n locally on Windows, and the execution order does not behave as expected. When running the workflow, I can clearly see that the execution order is as follows:

This behavior is unexpected and unpractical for me. Any ideas?

Many thanks

Welcome to the community @Lesterpaintstheworld !

Yes, the execution order is currently FIFO (first in, first out)

“Set text” executes and has connections to “Telegram”, “Embed thought” and “1” so it adds all of them to the execution stack (which is at that point empty) in the order you did connect them (guessing by the execution order you describe above it was exactly that order).

n8n goes then on and takes the next from the stack, which is “Telegram”. As it does not have any connections, it has nothing else to add.

After that, it takes the next from the stack and executes it, which is “Embed thought”. This has a connection to “Crypto” which gets added to the end of the stack. So after “1”.

Then “1” gets taken from the stack and executed. That node has a connection to “2” which gets added to the end of the stack. So after “Crypto”.

n8n keeps on doing that till there are no more nodes to execute.

1 Like

Btw. if you want to some nodes executed before others you can use the Merge Node and configure it accordingly.

1 Like

Thanks for the details. I think the merge node is what I need indeed!

Great to hear! Have fun!

Unless i am somehow messing up my experimentation I believe the above is not the case anymore?

Seems that branches execute based on physical hierarchy.

So in the last example it would be: 1, 2, 3, 5, 7, 4, 5, 8, 9.

ps. @Lesterpaintstheworld i follow(ed) your work and its nice to see your humble beginnings.

Welcome to the community @Nikto655 !

That is correct but you listed five twice. If you change the last one to a six it is correct: 1, 2, 3, 5, 7, 4, 6, 8, 9

That is something that changed with the release of n8n v1:

was a mistype with the second 5 on my part. Thank you.

I spent hours trying to figure out why mine wasnt working like the previous diagram shared. Is there anywhere to track/follow such changes as searching and finding the previous posts led me down the wrong path with this and i was only really able to figure it out because it was a pretty simple thing to test and solve for.

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