1
0
镜像自地址 https://github.com/tuna/tunasync.git 已同步 2025-12-06 06:26:46 +00:00

Merge pull request #130 from tuna/add-bolt-open-timeout

Add 5 seconds timeout for bolt
这个提交包含在:
Yuxiang Zhang
2020-08-05 12:41:29 +08:00
提交者 GitHub
当前提交 b34238c097

查看文件

@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"strings"
"time"
"github.com/boltdb/bolt"
@@ -26,7 +27,9 @@ type dbAdapter interface {
func makeDBAdapter(dbType string, dbFile string) (dbAdapter, error) {
if dbType == "bolt" {
innerDB, err := bolt.Open(dbFile, 0600, nil)
innerDB, err := bolt.Open(dbFile, 0600, &bolt.Options{
Timeout: 5 * time.Second,
})
if err != nil {
return nil, err
}