diff options
author | Kyomotoi <[email protected]> | 2022-11-04 20:21:51 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2022-11-04 20:21:51 +0800 |
commit | 9775416cff368dc8acbf2615f05bb86c7196b009 (patch) | |
tree | 31c278fd9a8a9bf0828b230cd4900b33c4c648b7 | |
parent | eed33245e5bdacdc0e38af2ee4a44bb9ae3336de (diff) | |
download | ATRI-9775416cff368dc8acbf2615f05bb86c7196b009.tar.gz ATRI-9775416cff368dc8acbf2615f05bb86c7196b009.tar.bz2 ATRI-9775416cff368dc8acbf2615f05bb86c7196b009.zip |
🚑️ 修复 bug
-rw-r--r-- | ATRI/plugins/console/driver/api.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ATRI/plugins/console/driver/api.py b/ATRI/plugins/console/driver/api.py index 4319954..668a308 100644 --- a/ATRI/plugins/console/driver/api.py +++ b/ATRI/plugins/console/driver/api.py @@ -2,7 +2,7 @@ import asyncio from fastapi import Depends, status from starlette.websockets import WebSocket, WebSocketState -from websockets.exceptions import ConnectionClosedOK +from websockets.exceptions import ConnectionClosedOK, ConnectionClosedError from .depends import * from .data_source import ( @@ -34,6 +34,8 @@ async def runtime_info(websocket: WebSocket, _pass=Depends(websocket_author)): await asyncio.sleep(1) except ConnectionClosedOK: pass + except ConnectionClosedError: + pass finally: await websocket.close() return @@ -50,6 +52,8 @@ async def message_info(websocket: WebSocket, _pass=Depends(websocket_author)): await asyncio.sleep(1) except ConnectionClosedOK: pass + except ConnectionClosedError: + pass finally: await websocket.close() return @@ -79,10 +83,10 @@ def block_list_info(_=Depends(http_author)): return {"status": status.HTTP_200_OK, "data": get_block_list()} -def edit_block_list( +async def edit_block_list( enabled: str, user_id: str = str(), group_id: str = str(), _=Depends(http_author) ): return { "status": status.HTTP_200_OK, - "data": _edit_block_list(bool(int(enabled)), user_id, group_id), + "data": await _edit_block_list(bool(int(enabled)), user_id, group_id), } |