mirror of
https://github.com/injoyai/tdx.git
synced 2025-11-26 21:25:35 +08:00
细节优化
This commit is contained in:
@@ -77,7 +77,7 @@ func NewCodes2(op ...Codes2Option) (*Codes2, error) {
|
|||||||
tempDir: filepath.Join(DefaultDataDir, "temp"),
|
tempDir: filepath.Join(DefaultDataDir, "temp"),
|
||||||
spec: "10 0 9 * * *",
|
spec: "10 0 9 * * *",
|
||||||
updateKey: "codes",
|
updateKey: "codes",
|
||||||
retry: 3,
|
retry: DefaultRetry,
|
||||||
dial: NewRangeDial(Hosts),
|
dial: NewRangeDial(Hosts),
|
||||||
dialOption: nil,
|
dialOption: nil,
|
||||||
m: maps.NewGeneric[string, *CodeModel](),
|
m: maps.NewGeneric[string, *CodeModel](),
|
||||||
@@ -117,7 +117,7 @@ func NewCodes2(op ...Codes2Option) (*Codes2, error) {
|
|||||||
// 定时更新
|
// 定时更新
|
||||||
cr := cron.New(cron.WithSeconds())
|
cr := cron.New(cron.WithSeconds())
|
||||||
_, err = cr.AddFunc(cs.spec, func() {
|
_, err = cr.AddFunc(cs.spec, func() {
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i == 0 || i < cs.retry; i++ {
|
||||||
if err := cs.Update(); err != nil {
|
if err := cs.Update(); err != nil {
|
||||||
logs.Err(err)
|
logs.Err(err)
|
||||||
<-time.After(time.Minute * 5)
|
<-time.After(time.Minute * 5)
|
||||||
|
|||||||
Reference in New Issue
Block a user