From 66cb0b1218aecb2ea56852e6fba2933044f3dc10 Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Tue, 5 Oct 2021 22:47:26 +0800 Subject: [PATCH] Fix: cache kv db should not block on init --- component/profile/cachefile/cache.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/component/profile/cachefile/cache.go b/component/profile/cachefile/cache.go index ffd58861..28b05ee0 100644 --- a/component/profile/cachefile/cache.go +++ b/component/profile/cachefile/cache.go @@ -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()) }