Merge pull request #357 from CartoDB/limit-batch-queries

set limit to batch queries to 12h
This commit is contained in:
Raul Ochoa 2016-10-06 13:04:51 +02:00 committed by GitHub
commit aa19120495
6 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,9 @@
1.37.2 - 2016-mm-dd
-------------------
Announcements:
* limited batch queries to 12 hours
1.37.1 - 2016-10-05
-------------------

View File

@ -1,6 +1,7 @@
'use strict';
var PSQL = require('cartodb-psql');
var BATCH_QUERY_TIMEOUT = global.settings.batch_query_timeout || 12 * 3600 * 1000; // 12 hours in millisecond
function QueryRunner(userDatabaseMetadataService) {
this.userDatabaseMetadataService = userDatabaseMetadataService;
@ -16,7 +17,7 @@ QueryRunner.prototype.run = function (job_id, sql, user, callback) {
var pg = new PSQL(userDatabaseMetadata, {}, { destroyOnError: true });
pg.query('SET statement_timeout=0', function (err) {
pg.query('SET statement_timeout=' + BATCH_QUERY_TIMEOUT, function (err) {
if(err) {
return callback(err);
}

View File

@ -30,6 +30,7 @@ module.exports.db_host = 'localhost';
module.exports.db_port = '5432';
module.exports.db_batch_port = '5432';
module.exports.finished_jobs_ttl_in_seconds = 2 * 3600; // 2 hours
module.exports.batch_query_timeout || 12 * 3600 * 1000; // 12 hours in milliseconds
module.exports.batch_log_filename = 'logs/batch-queries.log';
// Max database connections in the pool
// Subsequent connections will wait for a free slot.

View File

@ -31,6 +31,7 @@ module.exports.db_host = 'localhost';
module.exports.db_port = '6432';
module.exports.db_batch_port = '5432';
module.exports.finished_jobs_ttl_in_seconds = 2 * 3600; // 2 hours
module.exports.batch_query_timeout || 12 * 3600 * 1000; // 12 hours in milliseconds
module.exports.batch_log_filename = 'logs/batch-queries.log';
// Max database connections in the pool
// Subsequent connections will wait for a free slot.i

View File

@ -31,6 +31,7 @@ module.exports.db_host = 'localhost';
module.exports.db_port = '6432';
module.exports.db_batch_port = '5432';
module.exports.finished_jobs_ttl_in_seconds = 2 * 3600; // 2 hours
module.exports.batch_query_timeout || 12 * 3600 * 1000; // 12 hours in milliseconds
module.exports.batch_log_filename = 'logs/batch-queries.log';
// Max database connections in the pool
// Subsequent connections will wait for a free slot.

View File

@ -28,6 +28,7 @@ module.exports.db_host = 'localhost';
module.exports.db_port = '5432';
module.exports.db_batch_port = '5432';
module.exports.finished_jobs_ttl_in_seconds = 2 * 3600; // 2 hours
module.exports.batch_query_timeout || 12 * 3600 * 1000; // 12 hours in milliseconds
module.exports.batch_log_filename = 'logs/batch-queries.log';
// Max database connections in the pool
// Subsequent connections will wait for a free slot.