I am using meteor-job-collection
and has defined a worker
var workers = Job.processJobs( 'jobQueue', 'insertItems',
function ( job, cb ) {
// iterate
job.data.forEach( function ( item ) {
// insert
} );
// when done successfully
job.done();
// invoke the callback when work on this job has finished
return cb();
}
);
It seems that my server is hanging until the job has been processed. Have I done something wrong? Should I enclose it in wrapAsync
or Tracker.autorun
or something?
According to docs you should probably use options.concurrency
to increase amount of concurrent job that can be processed at one time. See screenshot of documentation of meteor-job-collection :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.