Skip to content

Commit 63ac470

Browse files
committed
Handle reconnects for MySQL read replicas with pooling
1 parent d60192f commit 63ac470

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/dialects/mysql/connector-manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,10 @@ module.exports = (function() {
351351
if (typeof(pool.destroy) == 'function') {
352352
pool.destroy(client)
353353
} else {
354-
if (pool.read && typeof(pool.read.destroy) == 'function') {
354+
if (client.queryType == 'read' && pool.read && typeof(pool.read.destroy) == 'function') {
355355
pool.read.destroy(client)
356356
}
357-
if (pool.write && typeof(pool.write.destroy) == 'function') {
357+
if (client.queryType == 'write' && pool.write && typeof(pool.write.destroy) == 'function') {
358358
pool.write.destroy(client)
359359
}
360360
}

0 commit comments

Comments
 (0)