[v1.x] Expire idle Streamable HTTP sessions by default and cap concurrent sessions (#3426)
This commit is contained in:
parent
5ebdfed406
commit
92120b4b0f
1 changed files with 904 additions and 226 deletions
|
|
@ -4,7 +4,6 @@ import logging
|
|||
import multiprocessing
|
||||
import re
|
||||
import socket
|
||||
from collections.abc import Iterator
|
||||
from typing import Any
|
||||
|
||||
import anyio
|
||||
|
|
@ -29,23 +28,6 @@ logger = logging.getLogger(__name__)
|
|||
SERVER_NAME = "test_sse_security_server"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def reset_sse_starlette_exit_event() -> Iterator[None]:
|
||||
"""sse-starlette<2 caches a module-level anyio.Event on AppStatus; clear it
|
||||
around each test so it is never bound to a closed event loop. Clearing it
|
||||
afterwards matters too: later test modules fork uvicorn subprocesses on
|
||||
Linux and would otherwise inherit a stale event."""
|
||||
from sse_starlette.sse import AppStatus
|
||||
|
||||
def clear() -> None:
|
||||
if hasattr(AppStatus, "should_exit_event"): # pragma: no cover
|
||||
setattr(AppStatus, "should_exit_event", None)
|
||||
|
||||
clear()
|
||||
yield
|
||||
clear()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def server_port() -> int:
|
||||
with socket.socket() as s:
|
||||
|
|
|
|||
Loading…
Reference in a new issue