Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: while_executing should not invoke conflict strategy when the job was successfully executed [v8] #810

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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