Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Jan 2, 2025
1 parent 47fbbe7 commit 813a8f4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/job/cert_renew.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ func (r *CertRenew) Run() {
}

// 结束时间大于 7 天的证书不续签
now := time.Now()
if decode.NotAfter.Sub(now).Hours() > 24*7 {
if time.Until(decode.NotAfter) > 24*7*time.Hour {
continue
}

Expand All @@ -73,7 +72,7 @@ func (r *CertRenew) Run() {
r.log.Warn("[Cert Renew] failed to parse panel cert", slog.Any("err", err))
return
}
if decode.NotAfter.Sub(time.Now()).Hours() < 24*7 {
_, err = shell.Exec("panel-cli https generate")
if time.Until(decode.NotAfter) < 24*7*time.Hour {
_, _ = shell.Exec("panel-cli https generate")
}
}

0 comments on commit 813a8f4

Please sign in to comment.