File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import sys
88import threading
99import time
10- from concurrent .futures import ThreadPoolExecutor
1110from typing import Any , Dict , List , Optional
1211
1312from fastapi import WebSocket
4342class ServiceManager :
4443 def __init__ (self ):
4544 self .process : Optional [subprocess .Popen ] = None
46- self .log_queue : asyncio .Queue = asyncio .Queue ()
45+ self .log_queue : asyncio .Queue = asyncio .Queue (maxsize = 1000 )
4746 self .active_connections : List [WebSocket ] = []
4847 self .output_thread : Optional [threading .Thread ] = None
4948 self .stop_event = threading .Event ()
@@ -523,6 +522,7 @@ def kill_process(process: subprocess.Popen) -> None:
523522 if self .is_worker_mode :
524523 processes = list (self .worker_processes .values ())
525524 if processes :
525+ from concurrent .futures import ThreadPoolExecutor
526526 with ThreadPoolExecutor (
527527 max_workers = max (1 , len (processes ))
528528 ) as executor :
Original file line number Diff line number Diff line change 11import asyncio
2- import inspect
32import json
43import logging
54import os
@@ -155,6 +154,7 @@ def init_from_config(self):
155154 logger .info (f"Loaded { len (self .workers )} workers from config" )
156155
157156 def _dispatch_listener_result (self , result : Any ):
157+ import inspect
158158 if not inspect .isawaitable (result ):
159159 return
160160 try :
You can’t perform that action at this time.
0 commit comments