优化索引数据库关闭速度

This commit is contained in:
刘祥超
2024-03-24 18:20:42 +08:00
parent d9cf043cfe
commit f425b0faf6
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
}