Flush the buffer on 'error'

This commit is contained in:
Lam Wei Li 2022-01-05 20:28:27 +08:00 committed by GitHub
parent fc2ba410ad
commit 4565359448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,7 +128,11 @@ function workerAppender(config) {
socket.on('timeout', socket.end.bind(socket));
// don't bother listening for 'error', 'close' gets called after that anyway
socket.on('close', createSocket);
socket.on('error', () => {});
socket.on('error', (e) => {
debug('connection error', e);
canWrite = false;
emptyBuffer();
});
}
createSocket();