zhangzengfei
2024-04-16 ca9e545d6fcc86e751e768f57d823704e9ad1340
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package cron
 
import (
    "gat1400Exchange/config"
    "gat1400Exchange/service"
    "github.com/go-co-op/gocron"
    "time"
)
 
var s *gocron.Scheduler
 
func init() {
    s = gocron.NewScheduler(time.UTC)
}
 
func Init() {
    s.Every(config.ForwardConf.RetryInterval).Minutes().StartImmediately().Do(service.ResendImageData)
    s.Every(config.ForwardConf.ReportInterval).Second().StartImmediately().Do(service.DeviceInfoReportTask)
 
    s.StartAsync()
}