Fix: cache kv db should not block on init

This commit is contained in:
gVisor bot 2021-10-05 22:47:26 +08:00
parent a50a642f01
commit 60bb29bade

View file

@ -6,6 +6,7 @@ import (
"io/ioutil"
"os"
"sync"
"time"
"github.com/Dreamacro/clash/component/profile"
C "github.com/Dreamacro/clash/constant"
@ -78,7 +79,7 @@ func (c *CacheFile) Close() error {
// TODO: remove migrateCache until 2022
func migrateCache() {
defer func() {
db, err := bolt.Open(C.Path.Cache(), fileMode, nil)
db, err := bolt.Open(C.Path.Cache(), fileMode, &bolt.Options{Timeout: time.Second})
if err != nil {
log.Warnln("[CacheFile] can't open cache file: %s", err.Error())
}