Before losing the reference to this.client, forcibly close the
connection to the Redis server.
If the Redis server couldn’t be reached in the first place
(ECONNREFUSED on connection), this also prevents node-redis from
auto-reconnecting indefinitely.
I couldn't come up with a simple test case, but here is a meaningful use case:
When the Redis server isn't available, client.stop() doesn't work as expected, as something keeps the event loop busy:
var Catbox = require('./');
var client = new Catbox.Client({
engine: 'redis',
partition: 'examples'
});
client.start(function (err) {
console.log(err);
client.stop();
});
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Before losing the reference to
this.client
, forcibly close the connection to the Redis server.If the Redis server couldn’t be reached in the first place (
ECONNREFUSED
on connection), this also prevents node-redis from auto-reconnecting indefinitely.I couldn't come up with a simple test case, but here is a meaningful use case:
When the Redis server isn't available,
client.stop()
doesn't work as expected, as something keeps the event loop busy:outputs:
(the program hangs there forever and needs to be stopped using
^C
)Whereas if the Redis server is available: