Giving a specific ID to a job created by Kue

188 Views Asked by At

I'm working with Kue and I'm creating Jobs to be added to Redis.

The problem i have is that when i destroy and recreate the Redis DB the Ids of the job created starts from 1.

so is there any way to create a job with Kue with a specific id so in Redis it will not start by 1 but by the id that i will specify.

1

There are 1 best solutions below

2
Anthony Kong On

The last job id is maintain by this key ids (see https://github.com/Automattic/kue/blob/87d61503d3d9cc024633efc7611bd25551f0f87d/lib/queue/job.js#L799)

In theory, you can set the id by setting the ids to a new number (says 1000) before you start your Kue process. Then the id will start from 1001 in this case.