You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having a hard time trying to get my job queue. Given the following setup:
constJobs=newJobCollection("Jobs",{noCollectionSuffix: true});Meteor.startup(()=>{Jobs.processJobs("import/media/sync",{pollInterval: 30*1000,payload: 5},(jobs,callback)=>{_.each(jobs,job=>{// do the job thing herejob.done();});callback();});});// jobs are added like so:newJob(Jobs,"import/media/sync",{}).priority("normal").save({cancelRepeats: true});
I expect "import/media/sync" to be called every 30 seconds with 5 jobs (when available). Instead, when timing the calls, I see the worker invoked pretty much immediately after the previous worker finished processing. Am I missing something or misusing the API?
The text was updated successfully, but these errors were encountered:
Hi, job-collection is optimized for throughput. the pollInterval is the rate at which processJobs will ask for work when its local queue is completely empty. When the queue is not empty, it also asks for work each time a job finishes (when the callback is invoked in the worker function).
So in your case, it will request more work immediately after to invoke callback(). This is by design.
If my understanding of what you want is correct, you can achieve it by simply doing:
I am having a hard time trying to get my job queue. Given the following setup:
I expect
"import/media/sync"
to be called every 30 seconds with 5 jobs (when available). Instead, when timing the calls, I see the worker invoked pretty much immediately after the previous worker finished processing. Am I missing something or misusing the API?The text was updated successfully, but these errors were encountered: