Use job service to add jobs to work-in-progress list
This commit is contained in:
parent
c1f2f9377d
commit
5b8108d4a8
@ -63,7 +63,11 @@ Batch.prototype.processJob = function (user, callback) {
|
|||||||
return callback(null, EMPTY_QUEUE);
|
return callback(null, EMPTY_QUEUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.setWorkInProgressJob(user, jobId);
|
self.setWorkInProgressJob(user, jobId, function (err) {
|
||||||
|
if (err) {
|
||||||
|
return callback(new Error('Could not add job to work-in-progress list. Reason: ' + err.message));
|
||||||
|
}
|
||||||
|
|
||||||
self.jobRunner.run(jobId, function (err, job) {
|
self.jobRunner.run(jobId, function (err, job) {
|
||||||
self.clearWorkInProgressJob(user);
|
self.clearWorkInProgressJob(user);
|
||||||
|
|
||||||
@ -85,6 +89,7 @@ Batch.prototype.processJob = function (user, callback) {
|
|||||||
return callback(null, !EMPTY_QUEUE);
|
return callback(null, !EMPTY_QUEUE);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Batch.prototype.drain = function (callback) {
|
Batch.prototype.drain = function (callback) {
|
||||||
@ -138,8 +143,9 @@ Batch.prototype.stop = function (callback) {
|
|||||||
|
|
||||||
/* Work in progress jobs */
|
/* Work in progress jobs */
|
||||||
|
|
||||||
Batch.prototype.setWorkInProgressJob = function(user, jobId) {
|
Batch.prototype.setWorkInProgressJob = function(user, jobId, callback) {
|
||||||
this.workInProgressJobs[user] = jobId;
|
this.workInProgressJobs[user] = jobId;
|
||||||
|
this.jobService.addWorkInProgressJob(user, jobId, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
Batch.prototype.getWorkInProgressJob = function(user) {
|
Batch.prototype.getWorkInProgressJob = function(user) {
|
||||||
|
Loading…
Reference in New Issue
Block a user