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,7 +26,12 @@ JobRunner.prototype.run = function (jobId) {
jobBackend.setRunning(job);
pg.eventedQuery(job.query, function (err, query) {
pg.query('SET statement_timeout=0', function(err) {
if(err) {
return jobBackend.setFailed(job, err);
}
pg.eventedQuery(job.query, function (err, query /* , queryCanceller */) {
query.on('error', function (err) {
jobBackend.setFailed(job, err);
});
@ -37,6 +42,7 @@ JobRunner.prototype.run = function (jobId) {
});
});
});
});
return jobBackend;
};

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,6 +28,7 @@ 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

View File

@ -29,6 +29,7 @@ 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

View File

@ -29,6 +29,7 @@ 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

View File

@ -26,6 +26,7 @@ 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

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) {