request_store-sidekiq provide an easy integration between
RequestStore allows you to easily create threadsafe code, and this middleware for
Sidekiq brings that functionality to Sidekiq workers, or even
You can install it as a gem:
gem install request_store-sidekiq
or add it into a Gemfile (Bundler):
# madebylotus/request_store-sidekiq: Provides an easy integration between RequestStore and Sidekiq
If using Rails, the Sidekiq middleware is already inserted into the Sidekiq middleware stack for you automatically and there is nothing to do.
And try the code to this:
Now no matter Sidekiq workers, or even
Sidekiq you use, you’ll get 1 every time: the storage is local to that worker.