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

Add 5 seconds timeout for bolt

这个提交包含在:
Jiajie Chen
2020-08-03 14:46:45 +08:00
父节点 16b4df1ec2
当前提交 16e458f354

查看文件

@@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"strings" "strings"
"time"
"github.com/boltdb/bolt" "github.com/boltdb/bolt"
@@ -26,7 +27,9 @@ type dbAdapter interface {
func makeDBAdapter(dbType string, dbFile string) (dbAdapter, error) { func makeDBAdapter(dbType string, dbFile string) (dbAdapter, error) {
if dbType == "bolt" { 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 { if err != nil {
return nil, err return nil, err
} }