cleaning stream copy

This commit is contained in:
Simon Martín 2018-06-08 17:04:28 +02:00
parent 6a9e7d7c14
commit b63806f8de

View File

@ -1,10 +1,6 @@
const zlib = require('zlib');
const PSQL = require('cartodb-psql'); const PSQL = require('cartodb-psql');
const copyTo = require('pg-copy-streams').to; const copyTo = require('pg-copy-streams').to;
const copyFrom = require('pg-copy-streams').from; const copyFrom = require('pg-copy-streams').from;
const StreamCopyMetrics = require('./stream_copy_metrics');
const { Client } = require('pg');
const Logger = require('./logger');
module.exports = { module.exports = {
to(sql, userDbParams, cb, next) { to(sql, userDbParams, cb, next) {
@ -21,9 +17,9 @@ module.exports = {
.on('end', () => { .on('end', () => {
done(); done();
next(null, copyToStream.rowCount); next(null, copyToStream.rowCount);
}) });
cb(null, pgstream, client, done) cb(null, pgstream, client, done);
}); });
}, },
@ -47,7 +43,7 @@ module.exports = {
next(null, copyFromStream.rowCount); next(null, copyFromStream.rowCount);
}); });
cb(null, pgstream, client, done) cb(null, pgstream, client, done);
}); });
} }
}; };