Module: Sidekiq::CurrentAttributes
- Defined in:
- lib/sidekiq/middleware/current_attributes.rb
Overview
Automatically save and load any current attributes in the execution context so context attributes “flow” from Rails actions into any associated jobs. This can be useful for multi-tenancy, i18n locale, timezone, any implicit per-request attribute. See ActiveSupport::CurrentAttributes
.
For multiple current attributes, pass an array of current attributes.
Defined Under Namespace
Class Method Summary collapse
Class Method Details
.persist(klass_or_array, config = Sidekiq.default_configuration) ⇒ Object
102 103 104 105 106 107 |
# File 'lib/sidekiq/middleware/current_attributes.rb', line 102 def persist(klass_or_array, config = Sidekiq.default_configuration) cattrs = build_cattrs_hash(klass_or_array) config.client_middleware.add Save, cattrs config.server_middleware.prepend Load, cattrs end |