fix(telegram): add shutdown guard to avoid duplicate restarts
Add a `_shutting_down` flag to `TelegramClient` to suppress disconnect handling during intentional shutdown. The flag is set before sending SIGTERM in `_restart_app` and checked in `_on_disconnect` to ignore those events. Minor formatting adjustments were also applied to `api_server.py` (try block and `uvicorn.run` arguments).
This commit is contained in:
+4
-5
@@ -121,12 +121,11 @@ if __name__ == "__main__":
|
||||
# Log uvloop status
|
||||
logger.info(" uvloop: enabled (asyncio speedup active)")
|
||||
|
||||
try:
|
||||
try:
|
||||
uvicorn.run(
|
||||
"api_server:app",
|
||||
host=Config["api_host"],
|
||||
port=Config["api_port"],
|
||||
reload=True,
|
||||
"api_server:app",
|
||||
host=Config["api_host"],
|
||||
port=Config["api_port"],
|
||||
loop="uvloop"
|
||||
)
|
||||
except OSError as e:
|
||||
|
||||
Reference in New Issue
Block a user