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

Clear the store after each background job being processed? #65

Open
khiav223577 opened this issue Oct 24, 2019 · 3 comments
Open

Clear the store after each background job being processed? #65

khiav223577 opened this issue Oct 24, 2019 · 3 comments

Comments

@khiav223577
Copy link

It seems that there is a gem that can deal with Sidekiq, but what about ActiveJob?

https://github.com/steveklabnik/request_store#using-with-sidekiq

A companion library, request_store-sidekiq creates a Sidekiq middleware that will ensure the store is cleared after each job is processed, for security and consistency with how this is done in Rack.

@johan-smits
Copy link

It is in the README ...or even ActiveJob backed Sidekiq

@khiav223577
Copy link
Author

It is in the README ...or even ActiveJob backed Sidekiq

Yah, but only with those ActiveJobs backed Sidekiq.

BTW, I use this workaround currently:

# app/jobs/application_job.rb
class ApplicationJob < ActiveJob::Base
  before_perform do
    RequestStore.clear!
  end
end

@johan-smits
Copy link

@khiav223577 that sounds like a good generic solution.

My suggestion would be make a PR to update the documentation with your code above.

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