Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis: jQuery pubsub example wiping out my redis data #477

Closed
roshanpaiva opened this issue Jul 5, 2012 · 4 comments
Closed

Redis: jQuery pubsub example wiping out my redis data #477

roshanpaiva opened this issue Jul 5, 2012 · 4 comments
Labels

Comments

@roshanpaiva
Copy link

I'm playing with atmosphere, specifically to read published events from redis. For this, i'm using the jquery-pubsub example. The example is great and gets me up and running very quickly.

Atmosphere version: 1.0.0.beta2a

Changes:

  • I uncommented out the following from the pom file so that atmosphere will be listening to redis events.

    org.atmosphere
    atmosphere-redis
    ${project.version}
  • uncommented out the following in the web.xml,

    org.atmosphere.plugin.redis.RedisBroadcaster.sharedPool
    true

Once the application loads, when i enter the topic i'm publishing redis events on, it displays it the values perfectly.

However i have a big problem, all the data i had in redis (data i had put in redis calling set "key" "value") has disappeared once the jquery-pubsub application starts. This is definitely not what i want. Is there something extra i need to do?

How i verified this was calling "keys *" in the redis-cli on my server. Before the application starts i have a bunch of keys in there. As soon as the application starts the keys are all wiped off.
"redis 127.0.0.1:6379> keys *
(empty list or set)"

Please let me know what i need to do to stop this from happening. This is very important.

@roshanpaiva
Copy link
Author

I think i found the problem.

Inside RedisBroadcaster, we call auth() after we subscribe or before we publish. Inside auth() we're calling jedis.flushAll(). This, i'm guessing is the culprit which clears all keys (http://redis.io/commands/flushall).

private void auth(Jedis jedis) {

    if (authToken != null) {
        jedis.auth(authToken);
    }
    jedis.flushAll();
}

Should we call flushAll() ? Or can i take it out? Appreciate your feedback and advise.

@jfarcand
Copy link
Member

jfarcand commented Jul 7, 2012

Good finding. Send me a private email and I will attach a patch that you can test and let me know if that fix the issue. Thanks!

@jfarcand
Copy link
Member

jfarcand commented Jul 7, 2012

OK the more I read, the more I think you are right. The fix is in, let me know how it goes.

@jfarcand jfarcand closed this as completed Jul 7, 2012
@roshanpaiva
Copy link
Author

Thanks a lot Jeanfrancois. I will check it out.

Roshan

On Jul 7, 2012, at 6:35 AM, Jeanfrancois Arcand reply@reply.github.com wrote:

OK the more I read, the more I think you are right. The fix is in, let me know how it goes.


Reply to this email directly or view it on GitHub:
#477 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants