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 44
55import  contextlib 
66import  logging 
7- import  threading 
87from  collections .abc  import  AsyncIterator 
98from  http  import  HTTPStatus 
109from  typing  import  Any 
@@ -75,7 +74,7 @@ def __init__(
7574        # The task group will be set during lifespan 
7675        self ._task_group  =  None 
7776        # Thread-safe tracking of run() calls 
78-         self ._run_lock  =  threading .Lock ()
77+         self ._run_lock  =  anyio .Lock ()
7978        self ._has_started  =  False 
8079
8180    @contextlib .asynccontextmanager  
@@ -97,7 +96,7 @@ async def lifespan(app: Starlette) -> AsyncIterator[None]:
9796                yield 
9897        """ 
9998        # Thread-safe check to ensure run() is only called once 
100-         with  self ._run_lock :
99+         async   with  self ._run_lock :
101100            if  self ._has_started :
102101                raise  RuntimeError (
103102                    "StreamableHTTPSessionManager .run() can only be called " 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments