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