mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-25 02:21:05 +01:00
fix: autocert scheduler using too high cpu usage
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
@@ -169,7 +168,7 @@ func (p *Provider) ScheduleRenewal(parent task.Parent) {
|
||||
return
|
||||
case <-timer.C:
|
||||
// Retry after 1 hour on failure
|
||||
if time.Now().Before(lastErrOn.Add(time.Hour)) {
|
||||
if !lastErrOn.IsZero() && time.Now().Before(lastErrOn.Add(time.Hour)) {
|
||||
continue
|
||||
}
|
||||
if err := p.renewIfNeeded(); err != nil {
|
||||
@@ -181,9 +180,6 @@ func (p *Provider) ScheduleRenewal(parent task.Parent) {
|
||||
lastErrOn = time.Time{}
|
||||
renewalTime = p.ShouldRenewOn()
|
||||
timer.Reset(time.Until(renewalTime))
|
||||
default:
|
||||
// Allow other tasks to run
|
||||
runtime.Gosched()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user