Handle error when client disconnects in copyto requests
This commit is contained in:
parent
6aba1ea307
commit
e6a331433a
@ -113,6 +113,13 @@ function handleCopyTo (logger) {
|
||||
})
|
||||
.on('end', () => responseEnded = true);
|
||||
|
||||
pgstream.on('error', (err) => {
|
||||
metrics.end(null, err);
|
||||
pgstream.unpipe(res);
|
||||
|
||||
return next(err);
|
||||
});
|
||||
|
||||
pgstream
|
||||
.on('data', data => metrics.addSize(data.length))
|
||||
.pipe(res);
|
||||
|
Loading…
Reference in New Issue
Block a user