Respect sidekiq_options overridden by .set #27
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sidekiq provides a
Sidekiq::Job.set(…)
API which can overridesidekiq_options
set at the class level, on a job-by-job instance basis. Sidekiq does the work of merging the options fromset
with those from the class-levelsidekiq_options
, into the "job" (really a normalized hash) that's handed to the middleware. So if we first look there for anydebounce:
options, rather than going to theklass.get_sidekiq_options
, we can respect any overrides from the.set
API.In this commit I left the
klass.get_sidekiq_options
as a fallback, though I'm not sure that's actually necessary.NOTE: This Sidekiq does not (currently?) deeply-merged nested options.
I've asked about this elsewhere: sidekiq/sidekiq#6366