Is there a way to force deleting the queue?
I am using publish / subscribe to manage the workers across multiple instances. Every time we spin up a new instance, it will create a special queue that subscribes to any command event like "start" or "stop"
The problem arises when we'd like to clean up this special queue when we shut down this instance. I want to delete the queue, but it will fail if there's any "completed" job in the queue. I had to manually set the archiveAfterCompletd to 5 seconds, but that will limit us to use the cron.
- Is there a better way to manage workers across instances?
- If not, is there a way to force deleting the queue even if there's any job in the queue?
You can use deleteQueue()
I think @ckblockit is using the deleteQueue() function. But the function fails if there are still jobs in the job table corresponding to that queue.
When runnnig boss.deleteQueue('test') on a queue which still has jobs in the job table:
error: update or delete on table "queue" violates foreign key constraint "q_fkey" on table "j90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809"
Key (name)=(test) is still referenced from table "j90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809".'
It does not matter if all those jobs are already completed.
This is already fixed in v11, but I haven't back ported it to v10 yet. Thanks for the nudge. I am almost ready to send it, but it's a big semver this time.
Also running into this. Glad to see it's resolved in the new version. Any ETA for v11? Thanks for all your work on this library @timgit , use it across a number of projects and love it.
I should be able to get this out by the end of this month. The biggest delay right now is determining "what to do with stately queues"