🐛 Ctrl+C 无法终止Channel接收线程的问题
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import threading
|
||||
|
||||
from nonebot import logger
|
||||
from liteyuki.comm.channel import get_channel
|
||||
from liteyuki.comm.channel import active_channel
|
||||
|
||||
|
||||
def reload(delay: float = 0.0, receiver: str = "nonebot"):
|
||||
@ -14,13 +14,9 @@ def reload(delay: float = 0.0, receiver: str = "nonebot"):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
chan = get_channel(receiver + "-active")
|
||||
if chan is None:
|
||||
logger.error(f"Channel {receiver}-active not found, cannot reload.")
|
||||
return
|
||||
|
||||
if delay > 0:
|
||||
threading.Timer(delay, chan.send, args=(1,)).start()
|
||||
threading.Timer(delay, active_channel.send, args=(1,)).start()
|
||||
return
|
||||
else:
|
||||
chan.send(1)
|
||||
active_channel.send(1)
|
||||
|
Reference in New Issue
Block a user