Add listWorkInProgressJobByUser function
This commit is contained in:
parent
8f65e6b16c
commit
f65208ba0d
@ -180,6 +180,12 @@ JobBackend.prototype.addWorkInProgressJob = function (user, jobId, callback) {
|
||||
], callback);
|
||||
};
|
||||
|
||||
JobBackend.prototype.listWorkInProgressJobByUser = function (user, callback) {
|
||||
var userWIPKey = WORK_IN_PROGRESS_JOB.PREFIX + user;
|
||||
|
||||
this.metadataBackend.redisCmd(WORK_IN_PROGRESS_JOB.DB, 'LRANGE', [userWIPKey, 0, -1], callback);
|
||||
};
|
||||
|
||||
JobBackend.prototype.setTTL = function (job, callback) {
|
||||
var self = this;
|
||||
var redisKey = REDIS_PREFIX + job.job_id;
|
||||
|
@ -33,9 +33,9 @@ function createWadusJob() {
|
||||
describe('job backend', function() {
|
||||
var jobBackend = new JobBackend(metadataBackend, jobQueue);
|
||||
|
||||
// after(function (done) {
|
||||
// redisUtils.clean('batch:*', done);
|
||||
// });
|
||||
after(function (done) {
|
||||
redisUtils.clean('batch:*', done);
|
||||
});
|
||||
|
||||
it('.create() should persist a job', function (done) {
|
||||
var job = createWadusJob();
|
||||
@ -109,4 +109,13 @@ describe('job backend', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('.listWorkInProgressJobByUser() should retrieve WIP jobs of given user', function (done) {
|
||||
jobBackend.listWorkInProgressJobByUser('vizzuality', function (err, jobs) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
assert.ok(jobs.length);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user