Compare commits

...

3 Commits

Author SHA1 Message Date
Nicholas Tindle
6704cce84a Merge branch 'dev' into claude/fix-queue-ordering-test-VgPU3 2026-01-09 14:56:03 -07:00
Nicholas Tindle
bc116999af Merge branch 'dev' into claude/fix-queue-ordering-test-VgPU3 2026-01-09 14:17:30 -07:00
Claude
3be5d2a61a fix(test): add timing delays to fix flaky queue ordering test
Add time.sleep(0.1) after publishing messages before consuming to ensure
all messages are fully committed to RabbitMQ. The test was flaky because
the 4th published message wasn't always visible in the queue when
consumption started immediately after publishing.
2026-01-09 20:47:35 +00:00

View File

@@ -167,6 +167,9 @@ def test_queue_ordering_behavior():
tester.publish_message(msg_b)
tester.publish_message(msg_c)
# Give RabbitMQ time to process all published messages before consuming
time.sleep(0.1)
# Consume and verify FIFO order: A, B, C
tester.received_messages = []
tester.stop_consuming.clear()
@@ -204,6 +207,9 @@ def test_queue_ordering_behavior():
# This is what happens in manager.py when requeue_by_republishing=True
tester.publish_message(user1_msg) # Goes to back via our method
# Give RabbitMQ time to process all published messages before consuming
time.sleep(0.1)
# Expected order: RATE-LIMITED, USER2-1, USER2-2, RATE-LIMITED (republished to back)
# This shows that user2 messages get processed instead of being blocked
tester.received_messages = []
@@ -234,6 +240,9 @@ def test_queue_ordering_behavior():
# Republish X (simulates requeue using our method)
tester.publish_message(msg_x)
# Give RabbitMQ time to process all published messages before consuming
time.sleep(0.1)
# Expected: X, Y, X (X was republished to back)
tester.received_messages = []
tester.stop_consuming.clear()