mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
fix: autocert scheduler using too high cpu usage
This commit is contained in:
parent
fc29e8f9fa
commit
2bb13129de
1 changed files with 1 additions and 5 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Add table
Reference in a new issue