File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import contextlib
6
6
import logging
7
- import threading
8
7
from collections .abc import AsyncIterator
9
8
from http import HTTPStatus
10
9
from typing import Any
@@ -75,7 +74,7 @@ def __init__(
75
74
# The task group will be set during lifespan
76
75
self ._task_group = None
77
76
# Thread-safe tracking of run() calls
78
- self ._run_lock = threading .Lock ()
77
+ self ._run_lock = anyio .Lock ()
79
78
self ._has_started = False
80
79
81
80
@contextlib .asynccontextmanager
@@ -97,7 +96,7 @@ async def lifespan(app: Starlette) -> AsyncIterator[None]:
97
96
yield
98
97
"""
99
98
# Thread-safe check to ensure run() is only called once
100
- with self ._run_lock :
99
+ async with self ._run_lock :
101
100
if self ._has_started :
102
101
raise RuntimeError (
103
102
"StreamableHTTPSessionManager .run() can only be called "
You can’t perform that action at this time.
0 commit comments