diff --git a/main.py b/main.py index 2e44d29..1255739 100644 --- a/main.py +++ b/main.py @@ -3,6 +3,7 @@ import logging import uvicorn import signal import os +import sys from starlette.applications import Starlette from starlette.routing import Route from starlette.responses import Response, StreamingResponse, FileResponse @@ -145,6 +146,5 @@ if __name__ == "__main__": except KeyboardInterrupt: pass finally: - # Final fallback to ensure the process actually dies - # if the event loop is still hanging on a connection - os._exit(0) + logger.info("Server process exiting.") + sys.exit(0)