[Misleading Documentation] The Job Schedulers id that the documentation refers to is the `key` field
The issue is that the jobSchedulers don't have an id property that the docs seemingly talk about, they have a key property. Example jobScheduler retrieved by getJobSchedulers:
The documentation talks about ids:
- when creating a
jobScheduler:
const firstJob = await queue.upsertJobScheduler('my-scheduler-id', { every: 1000, });
- when removing a
jobScheduler:
// Remove a job scheduler with ID 'scheduler-123' const result = await queue.removeJobScheduler('scheduler-123'); console.log( result ? 'Scheduler removed successfully' : 'Missing Job Scheduler', );
removeJobScheduler(jobSchedulerId): Promise<boolean>
- when getting a
jobScheduler:
The getJobScheduler method retrieves a job scheduler by id. This is invaluable for inspecting dedicated configurations.
const scheduler = await queue.getJobScheduler('test'); console.log('Current job scheduler:', scheduler);
getJobScheduler(id): Promise<JobSchedulerJson<DataType>>
And after all that, there is an optional id property on the jobScheduler:
interface JobSchedulerJson<D> { endDate?: number; every?: string; id?: string; iterationCount?: number; key: string; limit?: number; name: string; next?: number; pattern?: string; template?: JobSchedulerTemplateJson<D>; tz?: string; }
What is referred to as id everywhere in the documentation, is the key in the actual data. Calling removeJobScheduler with jobScheduler.key is what is working.
https://github.com/taskforcesh/bullmq/blob/5252f22546370f80531e48199ca74e902d8804e7/src/interfaces/job-scheduler-json.ts
There is a comment that says "key is actually the job scheduler id" next to the key field.
Should we update the variable name or improve the documentation?