{"action":"opened","issue":{"url":"https://api.github.com/repos/vsivsi/meteor-job-collection/issues/93","labels_url":"https://api.github.com/repos/vsivsi/meteor-job-collection/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/vsivsi/meteor-job-collection/issues/93/comments","events_url":"https://api.github.com/repos/vsivsi/meteor-job-collection/issues/93/events","html_url":"https://github.com/vsivsi/meteor-job-collection/issues/93","id":96658862,"number":93,"title":"Is depends() working properly?","user":{"login":"skosch","id":554383,"avatar_url":"https://avatars.githubusercontent.com/u/554383?v=3","gravatar_id":"","url":"https://api.github.com/users/skosch","html_url":"https://github.com/skosch","followers_url":"https://api.github.com/users/skosch/followers","following_url":"https://api.github.com/users/skosch/following{/other_user}","gists_url":"https://api.github.com/users/skosch/gists{/gist_id}","starred_url":"https://api.github.com/users/skosch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skosch/subscriptions","organizations_url":"https://api.github.com/users/skosch/orgs","repos_url":"https://api.github.com/users/skosch/repos","events_url":"https://api.github.com/users/skosch/events{/privacy}","received_events_url":"https://api.github.com/users/skosch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-22T20:41:15Z","updated_at":"2015-07-22T20:41:15Z","closed_at":null,"body":"Hi,\r\nfirst off, job-collection is fantastic, thanks for sharing it with the world!\r\n\r\nI have two jobs that need to run in sequence. The input data to the second job depends on the result of the first. I'm creating the second job in the `save()` callback of the first. However, the second job is called before the first one finishes, and so it's not getting the result it needs.\r\n\r\nI haven't found any point in the code that actually makes use of the `.depends` field—if such code exists, could you point me to it so I may understand it?\r\n\r\nThere is a test case: \r\n\r\n````\r\nTinytest.addAsync 'Dependent jobs run in the correct order', (test, onComplete) ->\r\n  jobType = \"TestJob_#{Math.round(Math.random()*1000000000)}\"\r\n  job = new Job testColl, jobType, { order: 1 }\r\n  job2 = new Job testColl, jobType, { order: 2 }\r\n  job.save (err, res) ->\r\n    test.fail(err) if err\r\n    test.ok validId(res), \"job.save() failed in callback result\"\r\n    job2.depends [job]\r\n    job2.save (err, res) ->\r\n      test.fail(err) if err\r\n      test.ok validId(res), \"job.save() failed in callback result\"\r\n      count = 0\r\n      q = testColl.processJobs jobType, { pollInterval: 250 }, (job, cb) ->\r\n        count++\r\n        test.equal count, job.data.order\r\n        job.done()\r\n        cb()\r\n        if count is 2\r\n          q.shutdown { level: 'soft', quiet: true }, () ->\r\n            onComplete()\r\n````\r\n... however, this only makes sure that the jobs run in the correct order, not that the first job is completed before the second one starts. Am I missing something, or is the actual `depends()` functionality simply not there?"}}