Disabled statement timeout bypassing pgbouncer connection

This commit is contained in:
Daniel García Aubert 2015-12-22 15:43:00 +01:00
parent 30d0b2906b
commit f41c43aa38
7 changed files with 22 additions and 13 deletions

View File

@ -26,13 +26,19 @@ JobRunner.prototype.run = function (jobId) {
jobBackend.setRunning(job);
pg.eventedQuery(job.query, function (err, query) {
query.on('error', function (err) {
jobBackend.setFailed(job, err);
});
pg.query('SET statement_timeout=0', function(err) {
if(err) {
return jobBackend.setFailed(job, err);
}
query.on('end', function () {
jobBackend.setDone(job);
pg.eventedQuery(job.query, function (err, query /* , queryCanceller */) {
query.on('error', function (err) {
jobBackend.setFailed(job, err);
});
query.on('end', function () {
jobBackend.setDone(job);
});
});
});
});

View File

@ -22,7 +22,7 @@ UserDatabaseMetadataService.prototype.parseMetadaToDatabase = function (userData
var dbParams = userDatabaseMetadata;
var dbopts = {
port: global.settings.db_port,
port: global.settings.db_batch_port,
pass: global.settings.db_pubuser_pass
};

View File

@ -28,9 +28,10 @@ module.exports.db_pubuser = 'publicuser';
module.exports.db_pubuser_pass = 'public';
module.exports.db_host = 'localhost';
module.exports.db_port = '5432';
module.exports.db_batch_port = '5432';
// Max database connections in the pool
// Subsequent connections will wait for a free slot.
// NOTE: not used by OGR-mediated accesses
// NOTE: not used by OGR-mediated accesses
module.exports.db_pool_size = 500;
// Milliseconds before a connection is removed from pool
module.exports.db_pool_idleTimeout = 30000;

View File

@ -29,9 +29,10 @@ module.exports.db_pubuser = 'publicuser';
module.exports.db_pubuser_pass = 'public';
module.exports.db_host = 'localhost';
module.exports.db_port = '6432';
module.exports.db_batch_port = '6432';
// Max database connections in the pool
// Subsequent connections will wait for a free slot.
// NOTE: not used by OGR-mediated accesses
// NOTE: not used by OGR-mediated accesses
module.exports.db_pool_size = 500;
// Milliseconds before a connection is removed from pool
module.exports.db_pool_idleTimeout = 30000;

View File

@ -29,9 +29,10 @@ module.exports.db_pubuser = 'publicuser';
module.exports.db_pubuser_pass = 'public';
module.exports.db_host = 'localhost';
module.exports.db_port = '6432';
module.exports.db_batch_port = '6432';
// Max database connections in the pool
// Subsequent connections will wait for a free slot.
// NOTE: not used by OGR-mediated accesses
// NOTE: not used by OGR-mediated accesses
module.exports.db_pool_size = 500;
// Milliseconds before a connection is removed from pool
module.exports.db_pool_idleTimeout = 30000;

View File

@ -26,9 +26,10 @@ module.exports.db_pubuser = 'testpublicuser';
module.exports.db_pubuser_pass = 'public';
module.exports.db_host = 'localhost';
module.exports.db_port = '5432';
module.exports.db_batch_port = '5432';
// Max database connections in the pool
// Subsequent connections will wait for a free slot.
// NOTE: not used by OGR-mediated accesses
// NOTE: not used by OGR-mediated accesses
module.exports.db_pool_size = 500;
// Milliseconds before a connection is removed from pool
module.exports.db_pool_idleTimeout = 30000;

View File

@ -18,10 +18,9 @@ describe('batch', function() {
var jobPublisher = new JobPublisher();
var jobBackend = new JobBackend(metadataBackend);
var username = 'vizzuality';
var sql = "select * from private_table limit 1";
var sql = "select * into batch_table from (select * from private_table limit 1) as job";
var _jobId = '';
var userDatabaseMetadataService = new UserDatabaseMetadataService(metadataBackend);
userDatabaseMetadataService.getUserMetadata(username, function (err, userDatabaseMetadata) {