N8N - LIFO execution

We have noticed a strange behavior of N8N with RabbitMQ, we noticed that it is using the LIFO method to execute the queue instead of FIFO.

Is there a setting or something for it?

I am not fully sure how I can share logs, execution data, or anything for this.
We just noticed that in our workflow, the last request got executed first and changed the status.

Let me explain how the process currently works
1: CRON will trigger the workflow-a
2: workflow-a will pull 100k+ records from DB
3: Loop with SplitInBatch with wait.
4: records are pushed to RabbitMq, one by one, with {{$node[“SplitInBatches”].context[“noItemsLeft”]}} flag.

5: Workflow-b with RabbitMq trigger will listen to the queue
6: Do its work
7: When the last item with {{$node[“SplitInBatches”].context[“noItemsLeft”]}} = true, comes it, it will set status to DONE after processing it.

What we noticed is, our status is set to DONE, even when we can see waiting for execution in ‘Workflow Executions’.

My doubt: Something with RabbitMq Queue & Redis bull queue is messing the queue up.

Information on your n8n setup

  • n8n version: 0.197.1
  • Database you’re using (default: SQLite): Postgres
  • Running n8n with the execution process [own(default), main]: Own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: AWS ECS autoscaling cluster.

Hi @MayurVirkar, I am not aware of an approach to changing the order in which executions are processed unfortunately, but perhaps @krynble can help with this one?

Hey @MayurVirkar this is really odd - our queue system (using Redis and Bull) uses FIFO.

We do process messages in parallel but there is nothing indicating LIFO - you can see how our node reads information from Rabbit MQ to kickstart the executions here.

Maybe this is a setting with RabbitMQ itself?

Maybe it’s due to the rate of RabbitMq message parallel consumption.
I have noticed that if RabbitMq has 500 messages, I can see 500 parallel executions in “Workflow Execution” immediately.

Is there any way to limit the RabbitMq message consumption by a workflow?
e.g. Say, I have a workflow that is executed by RabbitMq trigger. Can I have max 10 parallel executions of this workflow in “Workflow Execution”?

Yes this is one of the options you can add. You should be able to find it in the node at the options dropdown