Fixes #293, set cancel status to a job that actually is no running but has running status.
This commit is contained in:
parent
052cb0796d
commit
60ab3eb6ba
@ -26,6 +26,10 @@ function doCancel(job_id, userDatabaseMetadata, callback) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (!pid) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
doCancelQuery(pg, pid, function (err, isCancelled) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
@ -35,7 +39,7 @@ function doCancel(job_id, userDatabaseMetadata, callback) {
|
||||
return callback(new Error('Query has not been cancelled'));
|
||||
}
|
||||
|
||||
callback(null);
|
||||
callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -49,7 +53,8 @@ function getQueryPID(pg, job_id, callback) {
|
||||
}
|
||||
|
||||
if (!result.rows[0] || !result.rows[0].pid) {
|
||||
return callback(new Error('Query is not running currently'));
|
||||
// query is not running actually, but we have to callback w/o error to cancel the job anyway.
|
||||
return callback();
|
||||
}
|
||||
|
||||
callback(null, result.rows[0].pid);
|
||||
|
@ -36,19 +36,19 @@ JobService.prototype.list = function (user, callback) {
|
||||
}
|
||||
|
||||
var jobList = dataList.map(function (data) {
|
||||
var job;
|
||||
var job;
|
||||
|
||||
try {
|
||||
job = JobFactory.create(data);
|
||||
} catch (err) {
|
||||
return debug(err);
|
||||
}
|
||||
try {
|
||||
job = JobFactory.create(data);
|
||||
} catch (err) {
|
||||
return debug(err);
|
||||
}
|
||||
|
||||
return job;
|
||||
})
|
||||
.filter(function (job) {
|
||||
return job !== undefined;
|
||||
});
|
||||
return job;
|
||||
})
|
||||
.filter(function (job) {
|
||||
return job !== undefined;
|
||||
});
|
||||
|
||||
callback(null, jobList);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user