Skip to content
Open
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
9 changes: 6 additions & 3 deletions test/integration/concurrency_controls_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ class ConcurrencyControlsTest < ActiveSupport::TestCase
# and B finish quickly, freeing slots that drain D–H; C reads the empty
# status and pauses far longer than everyone else, so it saves last and its
# write (built on the empty status) overwrites all the others, leaving "C".
# A and B must pause long enough to still hold their semaphore slots while
# D–H are being enqueued, even on a slow CI runner — otherwise some of D–H
# claim a freed slot instead of blocking.
assert_no_difference -> { SolidQueue::BlockedExecution.count } do
ThrottledUpdateResultJob.perform_later(@result, name: "A", pause: 0.5.seconds)
ThrottledUpdateResultJob.perform_later(@result, name: "B", pause: 0.5.seconds)
ThrottledUpdateResultJob.perform_later(@result, name: "C", pause: 3.seconds)
ThrottledUpdateResultJob.perform_later(@result, name: "A", pause: 1.5.seconds)
ThrottledUpdateResultJob.perform_later(@result, name: "B", pause: 1.5.seconds)
ThrottledUpdateResultJob.perform_later(@result, name: "C", pause: 4.seconds)
end

wait_for(timeout: 2.seconds) { SolidQueue::ClaimedExecution.count >= 3 }
Expand Down
Loading