自动update push时间可自定义
This commit is contained in:
parent
21e60e980d
commit
44007a04b0
@ -14,5 +14,5 @@
|
||||
"https://hostloc.com/forum.php?mod=rss&fid=45&auth=389ec3vtQanmEuRoghE%2FpZPWnYCPmvwWgSa7RsfjbQ%2BJpA%2F6y6eHAx%2FKqtmPOg"
|
||||
],
|
||||
"refresh": 6,
|
||||
"isUpdatePush": true
|
||||
"autoUpdatePush": 1
|
||||
}
|
||||
|
||||
10
main.go
10
main.go
@ -14,9 +14,9 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Values []string `json:"values"`
|
||||
ReFresh int `json:"refresh"`
|
||||
IsUpdatePush bool `json:"isUpdatePush"`
|
||||
Values []string `json:"values"`
|
||||
ReFresh int `json:"refresh"`
|
||||
AutoUpdatePush int `json:"autoUpdatePush"`
|
||||
}
|
||||
|
||||
var (
|
||||
@ -88,10 +88,10 @@ func wsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
//如果未配置则不自动更新
|
||||
if !rssUrls.IsUpdatePush {
|
||||
if rssUrls.AutoUpdatePush == 0 {
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Duration(rssUrls.ReFresh+1) * time.Minute)
|
||||
time.Sleep(time.Duration(rssUrls.AutoUpdatePush) * time.Minute)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user