Node.js redis blpop with timeout not working

1.9k Views Asked by At

I have a very simple test program in Node.js:

// From 'npm install redis'
var redis = require("redis");

var client = redis.createClient();

client.blpop("mylist", 1, function (err, res) {
    if (err) {
        throw err;
    }

    console.log("Result is " + res);
});

If mylist is an empty list in Redis, this program has no output. I expect it to output "Result is null" after 1 second since the blocking pop operation should timeout, but it does not. What is going on?

0

There are 0 best solutions below