1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

Fix monitoring mode not always activating soon enough

This commit is contained in:
Ruben Bridgewater
2016-05-27 20:34:44 +02:00
parent 8b6f2dd35e
commit 25aa8f6710
2 changed files with 32 additions and 6 deletions

View File

@@ -55,8 +55,8 @@ RedisClient.prototype.monitor = RedisClient.prototype.MONITOR = function monitor
// Use a individual command, as this is a special case that does not has to be checked for any other command
var self = this;
var call_on_write = function () {
// Activating monitor mode has to happen before Redis returned the callback,
// as the client could receive monitoring commands before the callback returned through a race condition
// Activating monitor mode has to happen before Redis returned the callback. The monitor result is returned first.
// Therefore we expect the command to be properly processed. If this is not the case, it's not an issue either.
self.monitoring = true;
};
return this.internal_send_command(new Command('monitor', [], callback, call_on_write));