Get timeout from async function
This commit is contained in:
parent
7563868514
commit
26e4cb3196
@ -23,11 +23,13 @@ JobRunner.prototype.run = function (job_id, callback) {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
var query = job.getNextQuery();
|
self.getQueryStatementTimeout(job.data.user, function(err, timeout) {
|
||||||
var timeout = 12 * 3600 * 1000;
|
if (err) {
|
||||||
if (Number.isFinite(global.settings.batch_query_timeout)) {
|
return callback(err);
|
||||||
timeout = global.settings.batch_query_timeout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var query = job.getNextQuery();
|
||||||
|
|
||||||
if (_.isObject(query)) {
|
if (_.isObject(query)) {
|
||||||
if (Number.isFinite(query.timeout) && query.timeout > 0) {
|
if (Number.isFinite(query.timeout) && query.timeout > 0) {
|
||||||
timeout = Math.min(timeout, query.timeout);
|
timeout = Math.min(timeout, query.timeout);
|
||||||
@ -51,6 +53,16 @@ JobRunner.prototype.run = function (job_id, callback) {
|
|||||||
self._run(job, query, timeout, profiler, callback);
|
self._run(job, query, timeout, profiler, callback);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
JobRunner.prototype.getQueryStatementTimeout = function(username, callback) {
|
||||||
|
var timeout = 12 * 3600 * 1000;
|
||||||
|
if (Number.isFinite(global.settings.batch_query_timeout)) {
|
||||||
|
timeout = global.settings.batch_query_timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
return callback(null, timeout);
|
||||||
};
|
};
|
||||||
|
|
||||||
JobRunner.prototype._run = function (job, query, timeout, profiler, callback) {
|
JobRunner.prototype._run = function (job, query, timeout, profiler, callback) {
|
||||||
|
Loading…
Reference in New Issue
Block a user