1
0
forked from bot/app

🐛 Ctrl+C 无法终止Channel接收线程的问题

This commit is contained in:
2024-08-16 23:43:43 +08:00
parent 0417805e46
commit 85a13251a5
6 changed files with 123 additions and 51 deletions

View File

@ -93,10 +93,10 @@ class Channel:
装饰器,装饰一个函数在接收到数据后执行
"""
if (not self.is_sub_receive_loop_running) and not IS_MAIN_PROCESS:
threading.Thread(target=self._start_sub_receive_loop).start()
threading.Thread(target=self._start_sub_receive_loop, daemon=True).start()
if (not self.is_main_receive_loop_running) and IS_MAIN_PROCESS:
threading.Thread(target=self._start_main_receive_loop).start()
threading.Thread(target=self._start_main_receive_loop, daemon=True).start()
def decorator(func: ON_RECEIVE_FUNC) -> ON_RECEIVE_FUNC:
async def wrapper(data: Any) -> Any: