我正在使用 Node.js、Express、Redis 和 Socket.io。当 Redis 关闭时,Node.js 将终止。
我该如何防止这种情况,可能是在某个地方进行代码重新连接之类的?
输出:
info - socket.io started
Express server listening on port 3000
错误:
events.js:72
throw er; // Unhandled 'error' event
^ Error: Redis connection to 127.0.0.1:6380 failed - connect ECONNREFUSED
at RedisClient.on_error (...../node_modules/redis/index.js:151:24)
at Socket.<anonymous> (...../node_modules/redis/index.js:86:14)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:426:14
at process._tickCallback (node.js:415:13)