diff --git a/Changes.md b/Changes.md index c46861aba..db52c5d9a 100644 --- a/Changes.md +++ b/Changes.md @@ -24,6 +24,7 @@ SomeJob.set("sync": true).perform_async(args...) # will run via perform_inline ``` bin/rails generate sidekiq:job ProcessOrderJob ``` +- Fix job retries losing CurrentAttributes [#5090] 6.3.1 --------- diff --git a/lib/sidekiq/middleware/current_attributes.rb b/lib/sidekiq/middleware/current_attributes.rb index 079538a03..f62b587bb 100644 --- a/lib/sidekiq/middleware/current_attributes.rb +++ b/lib/sidekiq/middleware/current_attributes.rb @@ -20,7 +20,12 @@ def initialize(cattr) end def call(_, job, _, _) - job["cattr"] = @klass.attributes + attrs = @klass.attributes + if job.has_key?("cattr") + job["cattr"].merge!(attrs) + else + job["cattr"] = attrs + end yield end end