diff --git a/src/index.js b/src/index.js index cc239d8..16d43cb 100644 --- a/src/index.js +++ b/src/index.js @@ -46,6 +46,10 @@ class Lock { } else { // We assume `options.redis` is a connection string or options object. this._redisConnection = redis.createClient(options.redis); + /** + * Handle errors to avoid process crashes due to unhandled EventEmitter + */ + this._redisConnection.on('error', noop); this._redisSubscriber = redis.createClient(options.redis); } /**