Skip to content

Commit

Permalink
Issue #69 - Retry on EPIPE error
Browse files Browse the repository at this point in the history
Attempts to reuse a connection with MariaDB 10.3.8 sometimes results in an EPIPE error. Retry with a new connection when this happens, just like other dropped-connection errors.
  • Loading branch information
Adam Fanello committed Feb 28, 2020
1 parent 7909f3f commit 5da1ccb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ module.exports = (params) => {
client.destroy() // destroy connection on timeout
resetClient() // reset the client
reject(err) // reject the promise with the error
} else if (err && (/^PROTOCOL_ENQUEUE_AFTER_/.test(err.code) || err.code === 'PROTOCOL_CONNECTION_LOST')) {
} else if (err && (/^PROTOCOL_ENQUEUE_AFTER_/.test(err.code) || err.code === 'PROTOCOL_CONNECTION_LOST' || err.code === 'EPIPE')) {
resetClient() // reset the client
return resolve(query(...args)) // attempt the query again
} else if (err) {
Expand Down

0 comments on commit 5da1ccb

Please sign in to comment.