优化索引数据库关闭速度

This commit is contained in:
GoEdgeLab
2024-03-24 18:20:42 +08:00
parent 3a449c42fa
commit c2dc5fef28
2 changed files with 34 additions and 14 deletions

View File

@@ -406,11 +406,16 @@ func (this *SQLiteFileList) OnRemove(f func(item *Item)) {
func (this *SQLiteFileList) Close() error {
this.memoryCache.Destroy()
var group = goman.NewTaskGroup()
for _, db := range this.dbList {
if db != nil {
_ = db.Close()
}
var dbCopy = db
group.Run(func() {
if dbCopy != nil {
_ = dbCopy.Close()
}
})
}
group.Wait()
return nil
}