Merge pull request #371 from CartoDB/query-order

Query order
This commit is contained in:
Raul Ochoa 2016-10-06 18:50:12 +02:00 committed by GitHub
commit 1004131333
3 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@
Announcements:
* limited batch queries to 12 hours
* Multiple queries jobs pushed as first job between queries.
1.37.1 - 2016-10-05

View File

@ -82,7 +82,7 @@ JobRunner.prototype._run = function (job, query, profiler, callback) {
return callback(null, job);
}
self.jobQueue.enqueue(job.data.job_id, job.data.host, function (err) {
self.jobQueue.enqueueFirst(job.data.job_id, job.data.host, function (err) {
if (err) {
return callback(err);
}

View File

@ -2,6 +2,7 @@
var PSQL = require('cartodb-psql');
var BATCH_QUERY_TIMEOUT = global.settings.batch_query_timeout || 12 * 3600 * 1000; // 12 hours in millisecond
var debug = require('./util/debug')('query-runner');
function QueryRunner(userDatabaseMetadataService) {
this.userDatabaseMetadataService = userDatabaseMetadataService;
@ -25,6 +26,7 @@ QueryRunner.prototype.run = function (job_id, sql, user, callback) {
// mark query to allow to users cancel their queries
sql = '/* ' + job_id + ' */ ' + sql;
debug('Running query %s', sql);
pg.eventedQuery(sql, function (err, query) {
if (err) {
return callback(err);