Skip to content

Commit

Permalink
fix: while_executing should not invoke conflict strategy when the j…
Browse files Browse the repository at this point in the history
…ob was successfully executed [v8] (#810)

fix: following what #806 did to the 7.1
  • Loading branch information
cuzik committed Nov 11, 2023
1 parent c6a4138 commit 3f6b013
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 do
puts "BOGUS!"
nil
end

nil
end

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

0 comments on commit 3f6b013

Please sign in to comment.