mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
add full gc scheduler
This commit is contained in:
@@ -30,6 +30,7 @@ from app.helper.wallpaper import WallpaperHelper
|
||||
from app.log import logger
|
||||
from app.schemas import Notification, NotificationType, Workflow, ConfigChangeEventData
|
||||
from app.schemas.types import EventType, SystemConfigKey
|
||||
from app.utils.gc import auto_gc
|
||||
from app.utils.singleton import SingletonClass
|
||||
from app.utils.timer import TimerUtils
|
||||
|
||||
@@ -181,6 +182,11 @@ class Scheduler(metaclass=SingletonClass):
|
||||
"name": "订阅日历缓存",
|
||||
"func": SubscribeChain().cache_calendar,
|
||||
"running": False
|
||||
},
|
||||
"full_gc": {
|
||||
"name": "主动内存回收",
|
||||
"func": self.full_gc,
|
||||
"running": False
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,6 +419,19 @@ class Scheduler(metaclass=SingletonClass):
|
||||
}
|
||||
)
|
||||
|
||||
# 主动内存回收
|
||||
if settings.MEMORY_GC_INTERVAL:
|
||||
self._scheduler.add_job(
|
||||
self.start,
|
||||
"interval",
|
||||
id="full_gc",
|
||||
name="主动内存回收",
|
||||
hours=settings.MEMORY_GC_INTERVAL,
|
||||
kwargs={
|
||||
'job_id': 'full_gc'
|
||||
}
|
||||
)
|
||||
|
||||
# 初始化工作流服务
|
||||
self.init_workflow_jobs()
|
||||
|
||||
@@ -747,6 +766,13 @@ class Scheduler(metaclass=SingletonClass):
|
||||
"""
|
||||
SchedulerChain().clear_cache()
|
||||
|
||||
@auto_gc
|
||||
def full_gc(self):
|
||||
"""
|
||||
主动内存回收
|
||||
"""
|
||||
pass
|
||||
|
||||
def user_auth(self):
|
||||
"""
|
||||
用户认证检查
|
||||
|
||||
Reference in New Issue
Block a user