Skip to content

Commit d27e01d

Browse files
committed
test: assert the wake-up reset, not wall time
The prompt-processing test bounded elapsed time at 0.4 seconds, and a loaded CI runner measured 0.409 and failed the compatibility (3.4, 7.1) job. Wall time never observed the mechanism anyway: promptness comes from the enqueue signal interrupting the idle wait, and that interruption is visible as a polling interval reset with reason :wake_up. A poll-driven completion resets with :work instead, so the assertion still fails when the signal path breaks, without a wall clock in the loop.
1 parent 07005a8 commit d27e01d

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

test/integration/polling_test.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,26 @@ def signal
203203
test "processes local work promptly after reaching the idle ceiling" do
204204
SolidObjects.configuration.polling_interval = 0.025
205205
SolidObjects.configuration.idle_polling_interval = 1.0
206+
reset_reasons = Queue.new
207+
subscription = ActiveSupport::Notifications.subscribe(
208+
"solid_objects.polling.interval_changed"
209+
) { |event| reset_reasons << event.payload.fetch(:reason) }
206210
worker = SolidObjects::Worker.new
207211
worker_thread = Thread.new { worker.run }
208212
Timeout.timeout(3) do
209213
sleep 0.005 until worker.current_polling_interval >= 1.0
210214
end
211215

212-
started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
213216
message = WakeLatencyActor.ref("local").async.increment
214-
Timeout.timeout(0.4) do
217+
Timeout.timeout(2) do
215218
sleep 0.005 until message.status == "completed"
216219
end
217-
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started_at
218220

219-
assert_operator elapsed, :<, 0.4
221+
observed_reasons = []
222+
observed_reasons << reset_reasons.pop until reset_reasons.empty?
223+
assert_includes observed_reasons, :wake_up
220224
ensure
225+
ActiveSupport::Notifications.unsubscribe(subscription) if subscription
221226
worker&.request_shutdown
222227
worker_thread&.join(2)
223228
worker&.stop

0 commit comments

Comments
 (0)