mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-09 09:26:55 +08:00
feat: implement data cleanup chain for batch deletion of expired records
This commit is contained in:
@@ -15,6 +15,7 @@ from apscheduler.triggers.cron import CronTrigger
|
||||
|
||||
from app import schemas
|
||||
from app.chain import ChainBase
|
||||
from app.chain.data_cleanup import DataCleanupChain
|
||||
from app.chain.mediaserver import MediaServerChain
|
||||
from app.chain.recommend import RecommendChain
|
||||
from app.chain.site import SiteChain
|
||||
@@ -145,6 +146,11 @@ class Scheduler(ConfigReloadMixin, metaclass=SingletonClass):
|
||||
"func": self.clear_cache,
|
||||
"running": False,
|
||||
},
|
||||
"data_cleanup": {
|
||||
"name": "数据表清理",
|
||||
"func": DataCleanupChain().cleanup,
|
||||
"running": False,
|
||||
},
|
||||
"user_auth": {
|
||||
"name": "用户认证检查",
|
||||
"func": self.user_auth,
|
||||
@@ -345,6 +351,17 @@ class Scheduler(ConfigReloadMixin, metaclass=SingletonClass):
|
||||
kwargs={"job_id": "clear_cache"},
|
||||
)
|
||||
|
||||
# 数据表清理服务,每天凌晨执行一次
|
||||
self._scheduler.add_job(
|
||||
self.start,
|
||||
"cron",
|
||||
id="data_cleanup",
|
||||
name="数据表清理",
|
||||
hour=3,
|
||||
minute=30,
|
||||
kwargs={"job_id": "data_cleanup"},
|
||||
)
|
||||
|
||||
# 定时检查用户认证,每隔10分钟
|
||||
self._scheduler.add_job(
|
||||
self.start,
|
||||
|
||||
Reference in New Issue
Block a user