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

#reconnect suggested in README, but apparently no longer available? #221

Open
jrochkind opened this issue Oct 12, 2022 · 4 comments
Open

Comments

@jrochkind
Copy link
Contributor

The README suggests:

For normal work with fresh resque and resque-scheduler gems add next lines in lib/rake/resque.rake

 task "resque:pool:setup" do
   Resque::Pool.after_prefork do |job|
     Resque.redis.client.reconnect
   end
 end

However, in redis 5.x, it appears #reconnect is no longer available, that code raises:

NoMethodError: undefined method 'reconnect' for #<Redis::Client ...

Not sure what the appropriate replacement is, but seems like it's not that....

@GlauberrBatista
Copy link

I faced the same situation. According to the Redis gem changelog, Redis is capable of reconnecting automatically after a fork.
I've removed that line and it's working for me.
BTW, use resque 2.4.0 as it fixes the compatibility issues with Redis 5.

@nevans
Copy link
Collaborator

nevans commented Nov 8, 2022

Sorry I haven't gotten around to this yet. I'll gladly merge a README PR that provides guidance for both redis ~>4.0 and >5.0. I'll be trusting that the submitter has tested it... which is why I haven't had time to attempt it myself.

For that matter, a PR that adds CI against multiple versions of the redis and resque gems would also be very welcome! (This just prompted me to add #224. 😉)

@jrochkind
Copy link
Contributor Author

jrochkind commented Nov 8, 2022

I think maybe the reconnect suggested as config in README has not been necessary for some time, even well before redis-rb 5.0. Looks like since redis-rb 3.1.0 according to the CHANGELOG GlauberrBatista found. Meaning that whole after_fork config suggested in README is just not needed, maybe?

But I'm not sure how to test it.

@xhs345
Copy link

xhs345 commented Jan 18, 2024

Same experience for me. Resque workers were no longer starting after update. After removing line Resque.redis.client.reconnect things started working again.

Still have

    Resque::Pool.after_prefork do |job|
      ActiveRecord::Base.establish_connection
    end

not sure if that is required at this point either

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

No branches or pull requests

4 participants