This commit is contained in:
jxxghp 2023-10-20 12:54:06 +08:00
parent 4875db08e8
commit be5106c819
2 changed files with 7 additions and 5 deletions

View File

@ -103,10 +103,7 @@ class Command(metaclass=Singleton):
"id": "subscribe_search",
"type": "scheduler",
"description": "搜索订阅",
"category": "订阅",
"kwargs": {
'state': 'R'
}
"category": "订阅"
},
"/subscribe_delete": {
"func": SubscribeChain().remote_delete,
@ -233,7 +230,7 @@ class Command(metaclass=Singleton):
)
# 执行定时任务
self.scheduler.start(job_id=command.get("id"), **command.get("kwargs", {}))
self.scheduler.start(job_id=command.get("id"))
if userid:
self.chain.post_message(

View File

@ -60,6 +60,9 @@ class Scheduler(metaclass=Singleton):
"subscribe_search": {
"func": SubscribeChain().search,
"running": False,
"kwargs": {
"state": "R"
}
},
"subscribe_refresh": {
"func": SubscribeChain().refresh,
@ -218,6 +221,8 @@ class Scheduler(metaclass=Singleton):
return
self._jobs[job_id]["running"] = True
try:
if not kwargs:
kwargs = job.get("kwargs") or {}
job["func"](*args, **kwargs)
except Exception as e:
logger.error(f"定时任务 {job_id} 执行失败:{str(e)}")