mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-15 00:30:24 +08:00
启动时判断是否处于空闲时间决定是否执行fstrim
This commit is contained in:
@@ -24,15 +24,17 @@ func NewTrimDisksTask() *TrimDisksTask {
|
||||
// Start the task
|
||||
func (this *TrimDisksTask) Start() {
|
||||
// execute once
|
||||
err := this.loop()
|
||||
if err != nil {
|
||||
remotelogs.Warn("TRIM_DISKS", "trim disks failed: "+err.Error())
|
||||
if idles.IsMinHour() {
|
||||
err := this.loop()
|
||||
if err != nil {
|
||||
remotelogs.Warn("TRIM_DISKS", "trim disks failed: "+err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
var ticker = time.NewTicker(2 * 24 * time.Hour) // every 2 days
|
||||
idles.RunTicker(ticker, func() {
|
||||
// run the task
|
||||
err = this.loop()
|
||||
err := this.loop()
|
||||
if err != nil {
|
||||
remotelogs.Warn("TRIM_DISKS", "trim disks failed: "+err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user