Npm Kue Separate Queue per Company

35 Views Asked by At

In my application there are multiple Companies. And every company sends email.

The problem is that I have just one kue process to send all the mails. So, if one company is sending email for say 10 minutes, then until those emails finish, no other companies will be able to send emails.

So, I created separate kue process for each company (e.g. "simulation-batch-company-id-xxx") instead of the earlier ("simulation-batch").

This results in too many listeners.

Also, new Companies are added manually. So, I created a route that I can hit after manually adding another company, which will find all the companies in the database, and re-create kue.process "simulation-batch-company-id-xxx" for each of them.

Is this bad practice ? Are there alternatives ? This is an old code, so I don't think I'll be able to overhaul it all.

Please Help.

0

There are 0 best solutions below