Preventing callbacks from accidentally being called twice

This commit is contained in:
Daniel García Aubert 2018-06-13 18:26:58 +02:00
parent 270daae579
commit 7d1a0abadd

View File

@ -15,7 +15,7 @@ module.exports = class StreamCopy extends EventEmitter {
to(cb) {
this.pg.connect((err, client, done) => {
if (err) {
cb(err);
return cb(err);
}
const copyToStream = copyTo(this.sql);
@ -40,7 +40,7 @@ module.exports = class StreamCopy extends EventEmitter {
from(cb) {
this.pg.connect((err, client, done) => {
if (err) {
cb(err);
return cb(err);
}
const copyFromStream = copyFrom(this.sql);