test: synchronize deadline fanout assertion
This commit is contained in:
parent
8f0df3d393
commit
93890e72de
|
|
@ -238,6 +238,7 @@ async def test_deadline_reminders_bound_fanout_and_isolate_failed_devices(tmp_pa
|
||||||
)
|
)
|
||||||
active = 0
|
active = 0
|
||||||
peak = 0
|
peak = 0
|
||||||
|
two_active = asyncio.Event()
|
||||||
|
|
||||||
async def assigned():
|
async def assigned():
|
||||||
return {"complete": True, "items": [{"id": 1, "due_date": "2026-08-14T00:00:00Z"}]}
|
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
|
nonlocal active, peak
|
||||||
active += 1
|
active += 1
|
||||||
peak = max(peak, active)
|
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
|
active -= 1
|
||||||
if subscription["endpoint"].endswith("device-1"):
|
if subscription["endpoint"].endswith("device-1"):
|
||||||
raise RuntimeError("provider failed")
|
raise RuntimeError("provider failed")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user