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

add sidekiq middleware component to avoid reusing contexts between wo… #232

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pinnymz
Copy link

@pinnymz pinnymz commented Mar 26, 2019

…rkers

@pinnymz
Copy link
Author

pinnymz commented Mar 26, 2019

Related to #151, I have confirmed that context reuse between tasks is taking place on recycled threads. This PR will avoid leaking contexts of previous tasks by clearing out the context as a post-task operation.

@sharang-d
Copy link

It would be great to get some eyes on this if it fixes the issue with Sidekiq workers!

I'll try to test it in our app where we're seeing ActiveRecord::ConnectionTimeoutError exceptions once I can reliably reproduce them locally.

@Gargron
Copy link

Gargron commented Jun 24, 2020

How do you manage to make Sidekiq work with read-replicas at all? Sidekiq jobs will usually fail because they start processing faster than the replica lag so the data the job has to work with will be missing or out of date unless Sidekiq connects directly to master. If you have a solution to that, I'd love to know!

@bleonard
Copy link
Contributor

We pointed background workers always to the primary (writer) for this reason and that they often were doing updates anyway.

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

Successfully merging this pull request may close these issues.

None yet

4 participants