Skip to content

Commit 9b6c223

Browse files
committed
feat: add ECONNRESET to retry condition
ECONNRESET happens when the sql connection is closed from the server side. This will now retry the query with a new connection when this error is thrown
1 parent 60d1e01 commit 9b6c223

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ module.exports = (params) => {
194194
} else if (
195195
err && (/^PROTOCOL_ENQUEUE_AFTER_/.test(err.code)
196196
|| err.code === 'PROTOCOL_CONNECTION_LOST'
197-
|| err.code === 'EPIPE')
197+
|| err.code === 'EPIPE'
198+
|| err.code === 'ECONNRESET')
198199
) {
199200
resetClient() // reset the client
200201
return resolve(query(...args)) // attempt the query again

0 commit comments

Comments
 (0)