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

How to heal connection after errors when using Sidekiq #102

Open
favrik opened this issue Apr 20, 2021 · 1 comment
Open

How to heal connection after errors when using Sidekiq #102

favrik opened this issue Apr 20, 2021 · 1 comment

Comments

@favrik
Copy link

favrik commented Apr 20, 2021

Hello!

I'm using the worker example as a basis of my implementation, and all is fine until I get an exception in the worker, this goes through the Sidekiq retry flow, but on subsequent retries it appears the connection has not healed, is this expected? And if so, do you have any pointers on how to heal the connection?

It's super weird, after going through a lot of the issues, and finding other implementations (https://github.com/search?q=Apnotic&type=code and https://github.com/feedbin/feedbin/blob/a4d1423fceb5418782fb086e8a6211d73d20ad46/app/jobs/device_push_notification_send.rb) it looks like the worker as provided in the example should be enough.

Thanks!

@benubois
Copy link
Collaborator

benubois commented Sep 7, 2021

I haven't been able to test this since for some reason I never get broken connections.

I think the reload method from connection_pool is supposed to do exactly this:

You can reload a ConnectionPool instance in the case it is desired to close all connections to the pool and, unlike shutdown, afterwards recreate connections so the pool may continue to be used.

pool = Apnotic::ConnectionPool.new…
pool.reload { |connection| connection.close }

Ideally this should be addressed in net-http2 since connection_pool expects:

There is no provision for repairing or checking the health of a connection; connections should be self-repairing. This is true of the Dalli and Redis clients.

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

No branches or pull requests

2 participants