Skip to content

Commit 9cbd293

Browse files
committed
fix: raise the worker hang budget in the create race test
The create race test capped each worker at 30 seconds. SQLite retries a busy write up to lock_retry_attempts times, and every retry waits out the 5 second busy handler, so a starved worker can run for about a minute before it does any real work. The cap sat below that legitimate worst case, and CI failed on Rails 7.1 and 7.2 while the same jobs passed in a parallel run of the same commit. Raise the budget to 180 seconds, so it reports a worker that hangs rather than one that waits. Confirmed by forcing a worker to sleep past a shortened budget and watching the assertion fail.
1 parent 38d30b1 commit 9cbd293

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎test/integration/enqueue_test.rb‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
require "database_test_helper"
44

55
class EnqueueTest < ActiveSupport::TestCase
6+
WORKER_HANG_TIMEOUT = 180
7+
68
class CartActor < SolidObjects::Actor
79
actor_type "enqueue-carts"
810

@@ -116,10 +118,10 @@ def add(product_id:)
116118
end
117119

118120
threads.length.times { start << true }
119-
unfinished = threads.reject { |thread| thread.join(30) }
121+
unfinished = threads.reject { |thread| thread.join(WORKER_HANG_TIMEOUT) }
120122
unfinished.each(&:kill).each(&:join)
121123

122-
assert_empty unfinished, "an enqueue was still running after its timeout"
124+
assert_empty unfinished, "an enqueue hung for over #{WORKER_HANG_TIMEOUT} seconds"
123125
assert_empty errors.size.times.map { errors.pop }
124126
assert_equal (1..8).to_a, sequences.size.times.map { sequences.pop }.sort
125127
assert_equal 1, SolidObjects::Instance.where(actor_type: "enqueue-carts", actor_id: "alice").count

0 commit comments

Comments
 (0)