mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 23:20:25 +08:00
加快缓存策略启动速度
This commit is contained in:
@@ -579,16 +579,18 @@ func (this *FileStorage) initList() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
dir := this.dir()
|
// 使用异步防止阻塞主线程
|
||||||
|
go func() {
|
||||||
|
dir := this.dir()
|
||||||
|
|
||||||
// 清除tmp
|
// 清除tmp
|
||||||
files, err := filepath.Glob(dir + "/*/*/*.cache.tmp")
|
files, err := filepath.Glob(dir + "/*/*/*.cache.tmp")
|
||||||
if err != nil {
|
if err == nil && len(files) > 0 {
|
||||||
return err
|
for _, path := range files {
|
||||||
}
|
_ = os.Remove(path)
|
||||||
for _, path := range files {
|
}
|
||||||
_ = os.Remove(path)
|
}
|
||||||
}
|
}()
|
||||||
|
|
||||||
// 启动定时清理任务
|
// 启动定时清理任务
|
||||||
this.ticker = utils.NewTicker(30 * time.Second)
|
this.ticker = utils.NewTicker(30 * time.Second)
|
||||||
|
|||||||
Reference in New Issue
Block a user