Merge pull request 'Stabilize the event-loop release gate' (#886) from timmy/884-stabilize-release-gate into main
All checks were successful
CI / lint (push) Successful in 1m55s
CI / build-release (push) Successful in 6s
CI / browser-journey (push) Successful in 56s
CI / release-candidate (push) Successful in 6s

This commit is contained in:
timmy 2026-08-15 10:16:39 +00:00
commit 5201b18cae

View File

@ -1860,9 +1860,14 @@ async def test_session_registry_latency_does_not_block_the_event_loop(access_con
async def test_sign_in_throttle_lookup_does_not_block_the_event_loop(
access_control, monkeypatch
):
lookup_started = threading.Event()
lookup_finished = threading.Event()
class SlowAttempts:
def retry_after(self, source):
time.sleep(0.15)
lookup_started.set()
time.sleep(0.3)
lookup_finished.set()
return 17
def record_blocked(self, *, method):
@ -1874,15 +1879,13 @@ async def test_sign_in_throttle_lookup_does_not_block_the_event_loop(
sign_in = asyncio.create_task(
client.post("/api/v1/session", json={"access_token": "wrong"})
)
await asyncio.sleep(0)
started = time.perf_counter()
assert await asyncio.to_thread(lookup_started.wait, 1)
await asyncio.sleep(0.01)
heartbeat_elapsed = time.perf_counter() - started
assert not lookup_finished.is_set()
response = await sign_in
assert response.status_code == 429
assert response.headers["retry-after"] == "17"
assert heartbeat_elapsed < 0.08
@pytest.mark.anyio