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
{{ message }}
Repository navigation
Unhandled error when using queue.getJob(job_id) on job that doesn't exist #35
If I call queue.getJob(id) on an id that doesn't exist, the function fails without calling the failure callback.
Below, the call to hget returns null, so in fromData(), instantiating the job fails because data.data doesn't exist. By then we're already on the success-side of the callback, so there's no way to recover, as far as I know.
Is there something I'm missing?
Job.fromId = function (queue, jobId, cb) {
queue.client.hget(queue.toKey('jobs'), jobId, function (err, data) {
/* istanbul ignore if */
if (err) return cb(err);
return cb(null, Job.fromData(queue, jobId, data));
});
};
Job.fromData = function (queue, jobId, data) {
// no need for try-catch here since we made the JSON ourselves in job#toData
data = JSON.parse(data);
var job = new Job(queue, jobId, data.data, data.options);
job.status = data.status;
return job;
};
Activity
LewisJEllis commentedon Jan 19, 2016
Ah, I had assumed that a missing key would return an error in the hget callback, but apparently that's not the case.
This is definitely a bug; thanks for the catch. I'll put in a fix with the upcoming release.
avermeil commentedon Jan 19, 2016
Great! Is there a rough timeline for the upcoming release?
skeggse commentedon Jul 20, 2017
The rough timeline is now #64.
skeggse commentedon Aug 9, 2017
Oops, #48 is a duplicate of this. Also, this is fixed in
1.0.0(f2cfb01).