mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 07:06:36 +08:00
refactor: extract magic numbers to named constants for mnd lint compliance
This commit is contained in:
@@ -28,6 +28,11 @@ import (
|
||||
"github.com/hibiken/asynq"
|
||||
)
|
||||
|
||||
const (
|
||||
cleanupDedupWindow = 23 * time.Hour // 清理任务去重窗口
|
||||
cleanupMaxRetry = 3 // 清理任务最大重试次数
|
||||
)
|
||||
|
||||
var (
|
||||
scheduler *asynq.Scheduler
|
||||
schedulerOnce sync.Once
|
||||
@@ -62,8 +67,8 @@ func StartScheduler() error {
|
||||
if _, err = scheduler.Register(
|
||||
config.Config.Scheduler.CleanupUnusedUploadsTaskCron,
|
||||
asynq.NewTask(task.CleanupUnusedUploadsTask, nil),
|
||||
asynq.Unique(23*time.Hour),
|
||||
asynq.MaxRetry(3),
|
||||
asynq.Unique(cleanupDedupWindow),
|
||||
asynq.MaxRetry(cleanupMaxRetry),
|
||||
); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user