feat 服务增加清理缓存
This commit is contained in:
parent
87eae72f51
commit
0d3dfdcbda
@ -219,8 +219,5 @@ def execute_command(jobid: str,
|
||||
"""
|
||||
if not jobid:
|
||||
return schemas.Response(success=False, message="命令不能为空!")
|
||||
if jobid == "subscribe_search":
|
||||
Scheduler().start(jobid, state='R')
|
||||
else:
|
||||
Scheduler().start(jobid)
|
||||
Scheduler().start(jobid)
|
||||
return schemas.Response(success=True)
|
||||
|
@ -71,6 +71,10 @@ class Scheduler(metaclass=Singleton):
|
||||
"transfer": {
|
||||
"func": TransferChain().process,
|
||||
"running": False,
|
||||
},
|
||||
"clear_cache": {
|
||||
"func": SchedulerChain().clear_cache,
|
||||
"running": False,
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,6 +206,18 @@ class Scheduler(metaclass=Singleton):
|
||||
minutes=10
|
||||
)
|
||||
|
||||
# 缓存清理服务,每隔24小时
|
||||
self._scheduler.add_job(
|
||||
self.start,
|
||||
"interval",
|
||||
id="clear_cache",
|
||||
name="缓存清理",
|
||||
hours=24,
|
||||
kwargs={
|
||||
'job_id': 'clear_cache'
|
||||
}
|
||||
)
|
||||
|
||||
# 打印服务
|
||||
logger.debug(self._scheduler.print_jobs())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user