소스 검색

ignore CancelledError when stopping the server

Alex Cheema 11 달 전
부모
커밋
2e1233357c
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      main.py

+ 4 - 1
main.py

@@ -120,7 +120,10 @@ async def shutdown(signal, loop):
     [task.cancel() for task in server_tasks]
     print(f"Cancelling {len(server_tasks)} outstanding tasks")
     await asyncio.gather(*server_tasks, return_exceptions=True)
-    await server.stop()
+    try:
+        await server.stop()
+    except CancelledError:
+        pass
     loop.stop()
 
 async def run_model_cli(node: Node, inference_engine: InferenceEngine, model_name: str, prompt: str):