Skip to content

Commit 3a34d8b

Browse files
chrisguidryclaude
andcommitted
Widen redelivery timeouts in tests for Windows timer resolution
The redelivery counter test used 50ms timeout with 75ms sleep (25ms margin), and the abandoned worker test used 100ms/125ms. Windows ~15ms timer resolution makes these too tight, causing worker crashes in CI. Widened both to 200ms/250ms. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a0d3c05 commit 3a34d8b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/instrumentation/test_counters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ async def test_task():
343343

344344
await docket.add(test_task)()
345345

346-
worker = Worker(docket, redelivery_timeout=timedelta(milliseconds=50))
346+
worker = Worker(docket, redelivery_timeout=timedelta(milliseconds=200))
347347

348348
async with worker:
349349
worker._execute = AsyncMock(side_effect=Exception("Simulated worker failure")) # type: ignore[assignment]
@@ -354,9 +354,9 @@ async def test_task():
354354
"Simulated worker failure" in str(e) for e in exc_info.value.exceptions
355355
)
356356

357-
await asyncio.sleep(0.075)
357+
await asyncio.sleep(0.25)
358358

359-
worker2 = Worker(docket, redelivery_timeout=timedelta(milliseconds=100))
359+
worker2 = Worker(docket, redelivery_timeout=timedelta(milliseconds=200))
360360
async with worker2:
361361
await worker2.run_until_finished()
362362

tests/test_redelivery.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async def test_redelivery_from_abandoned_worker(docket: Docket, the_task: AsyncM
3636
await docket.add(the_task)()
3737

3838
async with Worker(
39-
docket, redelivery_timeout=timedelta(milliseconds=100)
39+
docket, redelivery_timeout=timedelta(milliseconds=200)
4040
) as worker_a:
4141
worker_a._execute = AsyncMock(side_effect=Exception("Nope")) # pyright: ignore[reportPrivateUsage]
4242
with pytest.raises(ExceptionGroup) as exc_info:
@@ -46,7 +46,7 @@ async def test_redelivery_from_abandoned_worker(docket: Docket, the_task: AsyncM
4646
the_task.assert_not_called()
4747

4848
async with Worker(
49-
docket, redelivery_timeout=timedelta(milliseconds=100)
49+
docket, redelivery_timeout=timedelta(milliseconds=200)
5050
) as worker_b:
5151
async with docket.redis() as redis:
5252
pending_info = await redis.xpending(
@@ -57,7 +57,7 @@ async def test_redelivery_from_abandoned_worker(docket: Docket, the_task: AsyncM
5757
"Expected one pending task in the stream"
5858
)
5959

60-
await asyncio.sleep(0.125) # longer than the redelivery timeout
60+
await asyncio.sleep(0.25) # longer than the redelivery timeout
6161

6262
await worker_b.run_until_finished()
6363

0 commit comments

Comments
 (0)