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 selectwas not run after re-connecting. cannot find how detect this, since error event doesn't fire in case. should do?


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -