javascript - select correct redis database on reconnect -
i have node application uses node_redis. upon application start, redis client created, correct database selected once, , client used every request:
this.redis = redis.createclient(port, host); this.redis.on('error', function(err) { console.log('redis error: ' + err); }); this.redis.send_command('select', [database]);
now problem is: when connection goes away (for example when redis manually restarted), node_redis automatically re-connects, it's on wrong database, since select
was not run after re-connecting. cannot find how detect this, since error event doesn't fire in case. should do?
Comments
Post a Comment