diff --git a/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb b/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb index 255a70307..d9a4dfa41 100644 --- a/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +++ b/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb @@ -16,7 +16,7 @@ def worker_method_defined?(method_sym) def worker_options return {} unless sidekiq_worker_class? - worker_class.get_sidekiq_options.stringify_keys + worker_class.get_sidekiq_options.deep_stringify_keys end # Tests that the diff --git a/spec/sidekiq_unique_jobs/sidekiq_worker_methods_spec.rb b/spec/sidekiq_unique_jobs/sidekiq_worker_methods_spec.rb index 9fe24e5aa..0a95ceefc 100644 --- a/spec/sidekiq_unique_jobs/sidekiq_worker_methods_spec.rb +++ b/spec/sidekiq_unique_jobs/sidekiq_worker_methods_spec.rb @@ -61,4 +61,24 @@ def initialize(worker_class) end end end + + describe "#worker_options" do + subject(:worker_options) { worker.worker_options } + + let(:worker_class) { UniqueJobOnConflictHash } + + it do + expect(worker_options).to eq( + { + "lock" => :until_and_while_executing, + "on_conflict" => { + "client" => :log, + "server" => :reschedule, + }, + "queue" => :customqueue, + "retry" => true, + }, + ) + end + end end diff --git a/spec/support/workers/unique_job_on_conflict_hash.rb b/spec/support/workers/unique_job_on_conflict_hash.rb new file mode 100644 index 000000000..07b00572d --- /dev/null +++ b/spec/support/workers/unique_job_on_conflict_hash.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# :nocov: + +class UniqueJobOnConflictHash + include Sidekiq::Worker + + sidekiq_options lock: :until_and_while_executing, + queue: :customqueue, + on_conflict: { client: :log, server: :reschedule } + + def perform(one, two) + [one, two] + end +end