-
Notifications
You must be signed in to change notification settings - Fork 229
/
task_queue.go
23 lines (21 loc) · 1.63 KB
/
task_queue.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package settings
type TaskQueue struct {
MaxRetryTimes int `json:"max_retry_times" default:"3"` // 单个任务失败后,最大重试次数,超过后会降一级
OneJobTimeOut int `json:"one_job_time_out" default:"300"` // 单个任务的超时时间 5 * 60 s
Interval int `json:"interval" default:"10"` // 任务的间隔,单位 s,这里会有一个限制,不允许太快,然后会做一定的随机时间范围,当前值 x ~ 2*x 之内随机
ExpirationTime int `json:"expiration_time" default:"90"` // 单位天。1. 一个视频的 CreatedTime 在这个时间范围内,都会被下载字幕(除非已经观看跳过启用了)。2. 如果下载失败的任务,AddTime 超过了这个时间,那么就标记为 Failed
DownloadSubDuringXDays int `json:"download_sub_during_x_days" default:"7"` // 如果创建了 x 天,且有内置的中文字幕,那么也不进行下载了
OneSubDownloadInterval int `json:"one_sub_download_interval" default:"12"` // 一个字幕下载的间隔(单位 h),不然老是一个循环。对比的基准是 OneJob 的 UpdateTime
CheckPublicIPTargetSite string `json:"check_pulic_ip_target_site" default:""` // 检测本机外网 IP 的目标地址,必须是返回直接的 IP 字符串,不需要解析。; 分割
}
func NewTaskQueue() *TaskQueue {
return &TaskQueue{
MaxRetryTimes: 3,
OneJobTimeOut: 300,
Interval: 10,
ExpirationTime: 90,
DownloadSubDuringXDays: 7,
OneSubDownloadInterval: 12,
CheckPublicIPTargetSite: "",
}
}