graceful exit
This commit is contained in:
@@ -9,6 +9,7 @@ from flask_pymongo import PyMongo
|
||||
from qcloud_cos import CosConfig
|
||||
from qcloud_cos import CosS3Client
|
||||
|
||||
from typing import Optional
|
||||
|
||||
mongo = PyMongo()
|
||||
|
||||
@@ -76,4 +77,15 @@ def register_namespaces(app):
|
||||
# 延迟导入以避免循环
|
||||
from .sockets.namespaces import VSCodeNamespace, AgentNamespace
|
||||
socketio.on_namespace(VSCodeNamespace("/vscode"))
|
||||
socketio.on_namespace(AgentNamespace("/agent"))
|
||||
socketio.on_namespace(AgentNamespace("/agent"))
|
||||
|
||||
|
||||
def close_extensions():
|
||||
# 按“最可能阻塞”的优先级依次停止
|
||||
try:
|
||||
if user_uuid2chatmanager:
|
||||
for uuid in user_uuid2chatmanager:
|
||||
user_uuid2chatmanager[uuid].disconnect(uuid)
|
||||
except Exception as e:
|
||||
print("Failed to shutdown scheduler: %s", e)
|
||||
|
||||
Reference in New Issue
Block a user