node-resque
node-resque copied to clipboard
Why does jobs need to be passed to queue?
The documentation has the following blurb:
new queuerequires only the "queue" variable to be set. You can also pass thejobshash to it.
What happens if I don't pass jobs? Why would I pass it if it's optional?
I was looking at the code (queue.ts), and it looked like the job's plugins would not run if I don't pass jobs to the queue (as const job = this.jobs[func]; would be undefined), is this intentional?
It's the other way around I think - if you don't pass jobs, queue.enqueue(), RunPlugins() would always succeed because the job couldn't be found.
I'll update the docs to to say:
new queue requires only the "queue" variable to be set. If you intent to run plugins before or after enquing a job, you should also pass the jobs hash to it.
It's the other way around I think - if you don't pass
jobs,queue.enqueue(), RunPlugins() would always succeed because the job couldn't be found.
That's what I meant – the plugins set for the job would never run unless jobs is passed to the queue. Changing the docs sounds like a good idea, although in my mind it almost sounds like it should be a mandatory parameter, because the behavior without it is quite surprising in my opinion.
Ah, understood! Please send in a PR with your suggested change, and we can discuss it there!
Ping! checking in @fo-fo - do you need any help with that PR?
Ping! checking in @fo-fo - do you need any help with that PR?
Hey, sorry, I haven't had time to do it (yet at least). Actually it's not a big deal to me whether the documentation gets changed, although I appreciate you verifying my assumption about how it works!
I'd be very happy with the update if you could make it!