mirror of
https://github.com/tuna/tunasync.git
synced 2025-04-20 11:42:43 +00:00
Merge pull request #130 from tuna/add-bolt-open-timeout
Add 5 seconds timeout for bolt
This commit is contained in:
commit
b34238c097
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user