Sidekiq::SerializedCurrentAttributes
Extends Sidekiq::CurrentAttributes to serialize values (such as activerecord objects).
Installation
Install the gem and add to the application's Gemfile by executing:
bundle add sidekiq-serialized_current_attributes
Usage
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.
require "sidekiq/serialized_current_attributes"
Sidekiq::SerializedCurrentAttributes.persist("Myapp::Current")
Sidekiq::SerializedCurrentAttributes.persist(["Myapp::Current", "Myapp::OtherCurrent"])
Sidekiq::SerializedCurrentAttributes.discard_destroyed = true
Changelog
0.1.3 (2024-10-28)
- Reference global ::ActiveJob
- Prepend Load to server middleware
0.1.2 (2024-01-08)
0.1.1 (2023-10-16)
- Add option to discard destroyed records
0.1.0