small style details
This commit is contained in:
parent
e7750eb4c8
commit
59dd495a87
@ -71,14 +71,14 @@ function handleCopyTo (logger) {
|
||||
res.header("Content-Disposition", `attachment; filename=${encodeURIComponent(filename)}`);
|
||||
res.header("Content-Type", "application/octet-stream");
|
||||
|
||||
streamCopy.getPGStream(StreamCopy.ACTION_TO, function (err, pgstream) {
|
||||
streamCopy.getPGStream(StreamCopy.ACTION_TO, (err, pgstream) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
pgstream
|
||||
.on('data', data => metrics.addSize(data.length))
|
||||
.on('error', (err) => {
|
||||
.on('error', err => {
|
||||
metrics.end(null, err);
|
||||
pgstream.unpipe(res);
|
||||
|
||||
@ -94,8 +94,7 @@ function handleCopyTo (logger) {
|
||||
.on('error', err => {
|
||||
pgstream.emit('error', err);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@ -108,7 +107,7 @@ function handleCopyFrom (logger) {
|
||||
const streamCopy = new StreamCopy(sql, userDbParams);
|
||||
const metrics = new StreamCopyMetrics(logger, 'copyfrom', sql, user, isGzip);
|
||||
|
||||
streamCopy.getPGStream(StreamCopy.ACTION_FROM, function (err, pgstream) {
|
||||
streamCopy.getPGStream(StreamCopy.ACTION_FROM, (err, pgstream) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
@ -127,7 +126,7 @@ function handleCopyFrom (logger) {
|
||||
.pipe(isGzip ? zlib.createGunzip() : new PassThrough())
|
||||
.on('data', data => metrics.addSize(data.length))
|
||||
.pipe(pgstream)
|
||||
.on('error', (err) => {
|
||||
.on('error', err => {
|
||||
metrics.end(null, err);
|
||||
req.unpipe(pgstream);
|
||||
return next(err);
|
||||
@ -146,8 +145,7 @@ function handleCopyFrom (logger) {
|
||||
total_rows: rows
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user