Make the SET statement_timeout async

This commit is contained in:
Rafa de la Torre 2018-07-20 16:24:33 +02:00
parent fdab0136e6
commit cc348f3725

View File

@ -33,7 +33,11 @@ module.exports = class StreamCopy {
return cb(err); return cb(err);
} }
client.query('SET statement_timeout=' + this.timeout); client.query('SET statement_timeout=' + this.timeout, (err) => {
if (err) {
return cb(err);
}
let streamMaker = action === ACTION_TO ? copyTo : copyFrom; let streamMaker = action === ACTION_TO ? copyTo : copyFrom;
this.stream = streamMaker(this.sql); this.stream = streamMaker(this.sql);
@ -57,6 +61,7 @@ module.exports = class StreamCopy {
cb(null, pgstream); cb(null, pgstream);
}); });
});
} }
getRowCount() { getRowCount() {