diff --git a/lib/sidekiq_unique_jobs/lock/while_executing.rb b/lib/sidekiq_unique_jobs/lock/while_executing.rb index a7affb689..0aecf9a32 100644 --- a/lib/sidekiq_unique_jobs/lock/while_executing.rb +++ b/lib/sidekiq_unique_jobs/lock/while_executing.rb @@ -42,6 +42,7 @@ def execute(&block) with_logging_context do executed = locksmith.execute do yield + item[JID] ensure unlock_and_callback end diff --git a/spec/sidekiq_unique_jobs/lock/while_executing_spec.rb b/spec/sidekiq_unique_jobs/lock/while_executing_spec.rb index ba5448127..07a1d1373 100644 --- a/spec/sidekiq_unique_jobs/lock/while_executing_spec.rb +++ b/spec/sidekiq_unique_jobs/lock/while_executing_spec.rb @@ -91,10 +91,12 @@ it "reflects execution_failed" do process_one.execute do - process_two.execute { puts "BOGUS!" } - # NOTE: Below looks weird but tests that - # the result from process_two (which is nil) isn't considered. - jid_one + process_two.execute do + puts "BOGUS!" + nil + end + + nil end expect(process_one).not_to have_received(:reflect).with(:execution_failed, item_one)