mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-25 22:46:34 +08:00
自动在空闲时间执行定时任务
This commit is contained in:
@@ -5,6 +5,7 @@ package cachehits
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeNode/internal/goman"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/utils/fasttime"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/utils/idles"
|
||||
memutils "github.com/TeaOSLab/EdgeNode/internal/utils/mem"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
"sync"
|
||||
@@ -58,7 +59,7 @@ func NewStat(goodRatio uint64) *Stat {
|
||||
}
|
||||
|
||||
func (this *Stat) init() {
|
||||
for range this.ticker.C {
|
||||
idles.RunTicker(this.ticker, func() {
|
||||
var currentTime = fasttime.Now().Unix()
|
||||
|
||||
this.mu.RLock()
|
||||
@@ -73,7 +74,7 @@ func (this *Stat) init() {
|
||||
}
|
||||
}
|
||||
this.mu.RUnlock()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (this *Stat) IncreaseCached(category string) {
|
||||
|
||||
Reference in New Issue
Block a user