From f368c8a63f7de8883ffbfd390409d4e55995d58e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E9=AA=85?= Date: Wed, 30 Jan 2019 01:53:17 +0800 Subject: [PATCH] fix(Cluster): ignore connection errors for subscriber. (#790) The errors will be caught by connection pool and a new election will be made when the current subscriber is lost, so we can safely ignore these errors. Fix #768 --- lib/cluster/ClusterSubscriber.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cluster/ClusterSubscriber.ts b/lib/cluster/ClusterSubscriber.ts index f8ecd216..11c1e0b7 100644 --- a/lib/cluster/ClusterSubscriber.ts +++ b/lib/cluster/ClusterSubscriber.ts @@ -74,6 +74,9 @@ export default class ClusterSubscriber { lazyConnect: true }) + // Ignore the errors since they're handled in the connection pool. + this.subscriber.on('error', noop) + // Re-subscribe previous channels var previousChannels = { subscribe: [], psubscribe: [] } if (lastActiveSubscriber) {