Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

smembers returning different values. #370

ghost opened this Issue Feb 5, 2013 · 2 comments


None yet
2 participants

ghost commented Feb 5, 2013

var Redis = function() {
    var Url = require("url");
    var redisUrl = Url.parse(process.env.MP_STATS_REDIS_URL);
    var Redis = require("redis").createClient(redisUrl.port, redisUrl.hostname);
    return Redis;

var redis = Redis();
var redis2 = Redis();

var array = ['srting1', 'srting2']; //  contains 17 strings
redis.sadd("queued", array, function(err, response) {

  if (err) {


  } else {

    console.log(response); // returns 17
    setInterval(function() {

      redis2.smembers("queued", function(err2, members) {
        console.log(members); // first time returns an array half of which is null
        console.log(members); // second....5th time returns a single string
        console.log(members); // 6th and after contains the correct resposne
        // redis-cli always returns correct resposne

    }, 1000)



brycebaril commented Feb 6, 2013

I'm unable to reproduce the problem with your code, every output is the same. Are you sure this is the code where you saw the problem? If console.log(members) was unstable within the same scope that would be a completely different non-Redis related problem.


ghost commented Feb 6, 2013

yes, I'm sure. I guess you can close this.

@ghost ghost closed this Feb 6, 2013

@BridgeAR BridgeAR added the question label Jan 3, 2016

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment