Feat: upload session recycle crontab job / API for cleanup all upload session

This commit is contained in:
HFO4
2022-02-27 14:16:36 +08:00
parent 3444b4a75e
commit 7dd636da74
21 changed files with 248 additions and 21 deletions

View File

@@ -21,13 +21,18 @@ func Reload() {
func Init() {
util.Log().Info("初始化定时任务...")
// 读取cron日程设置
options := model.GetSettingByNames("cron_garbage_collect")
options := model.GetSettingByNames(
"cron_garbage_collect",
"cron_recycle_upload_session",
)
Cron := cron.New()
for k, v := range options {
var handler func()
switch k {
case "cron_garbage_collect":
handler = garbageCollect
case "cron_recycle_upload_session":
handler = uploadSessionCollect
default:
util.Log().Warning("未知定时任务类型 [%s],跳过", k)
continue