test: synchronize deadline fanout assertion
All checks were successful
CI / lint (pull_request) Successful in 1m26s
CI / build-release (pull_request) Successful in 5s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy 2026-08-13 07:27:22 +00:00
parent 8f0df3d393
commit 93890e72de

View File

@ -238,6 +238,7 @@ async def test_deadline_reminders_bound_fanout_and_isolate_failed_devices(tmp_pa
)
active = 0
peak = 0
two_active = asyncio.Event()
async def assigned():
return {"complete": True, "items": [{"id": 1, "due_date": "2026-08-14T00:00:00Z"}]}
@ -246,7 +247,9 @@ async def test_deadline_reminders_bound_fanout_and_isolate_failed_devices(tmp_pa
nonlocal active, peak
active += 1
peak = max(peak, active)
await asyncio.sleep(0.01)
if active == 2:
two_active.set()
await asyncio.wait_for(two_active.wait(), timeout=0.5)
active -= 1
if subscription["endpoint"].endswith("device-1"):
raise RuntimeError("provider failed")