vsivsi / meteor-job-collection

A persistent and reactive job queue for Meteor, supporting distributed workers that can run anywhere.
https://atmospherejs.com/vsivsi/job-collection
Other
385 stars 68 forks source link

looped jc.getJob() != jc.getJobs() #163

Closed Szayet closed 5 years ago

Szayet commented 8 years ago

Looping jc.getJob return the job's with their document _ids included whereas jc.getJobs does not conclude _id field in the returned job's documents.

The following code, (if jobs declared by getJobs) wont work because of the following error: Error: Each provided object must be a saved Job instance (with an _id) Meanwhile looping getJob get's the job done. ;)

while(jobs.length > 1) {
      var currentJob = jobs.shift();
      currentJob.pause();
      currentJob.depends(jobs).save();
}
vsivsi commented 8 years ago

I just wrote a unit test for this and I can't reproduce the behavior you describe.

See this commit: https://github.com/vsivsi/meteor-job-collection/commit/6945167fed13e0af6a4600ef9eea4c416a6a63f3