Running into out of order issue with my task queue (kue.js)

194 Views Asked by At

I'm not really sure how to fix this, but it's rather annoying and screwing up things for me in production. I'm using kue.js to complete a task after a user has done something. The most typical case on my site is for uploading images and sending emails.

It works most of the time, but other times, it seems that some jobs may not complete or they get in a weird ordering so that when they actually DO finish, the data that's returned from them is out of order, so when it does a database update in the callback of the task, it'll write the wrong image.

I'm pretty new to job queues in general, so if I'm missing something obvious, please don't hurt me. What should I be doing to ensure this doesn't happen or is this just the nature of queues?

1

There are 1 best solutions below

0
On

You should not expect tasks to be executed in the same order as they got published to your task queue; I am not familiar with kue.js so I dont know if there is some support for task grouping. if yes, you should use it.