Use pdql.end with callback

This commit is contained in:
Daniel García Aubert
2018-11-05 18:14:26 +01:00
parent 71b8699f47
commit 659b0ba889
2 changed files with 4 additions and 7 deletions
+1 -4
View File
@@ -1262,8 +1262,6 @@ TestClient.prototype.getDBConnection = function () {
return psql;
};
const pg = require('pg');
TestClient.prototype.setUserDatabaseTimeoutLimit = function (timeoutLimit, callback) {
const dbname = _.template(global.environment.postgres_auth_user, { user_id: 1 }) + '_db';
const dbuser = _.template(global.environment.postgres_auth_user, { user_id: 1 });
@@ -1290,8 +1288,7 @@ TestClient.prototype.setUserDatabaseTimeoutLimit = function (timeoutLimit, callb
},
// we need to guarantee all new connections have the new settings
function refreshPoolConnection () {
pg.once('end', () => callback());
pg.end();
psql.end(() => callback());
}
);
};