Skip to content

Commit

Permalink
Fixes issue #800 of sidekiq unique jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrogoe committed Aug 19, 2023
1 parent 9682f16 commit 34cd7c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/sidekiq_unique_jobs/lock/while_executing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def execute(&block)
with_logging_context do
executed = locksmith.execute do
yield
item[JID]
ensure
unlock_and_callback
end
Expand Down
10 changes: 6 additions & 4 deletions spec/sidekiq_unique_jobs/lock/while_executing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
puts "BOGUS!"
nil
}

nil
end

expect(process_one).not_to have_received(:reflect).with(:execution_failed, item_one)
Expand Down

0 comments on commit 34cd7c2

Please sign in to comment.