From 591ee9063efc488ed6036dba942faee9bd3e0c04 Mon Sep 17 00:00:00 2001 From: Eirik Martiniussen Sylliaas Date: Tue, 5 Mar 2019 21:06:00 +0100 Subject: [PATCH] Add open db timeout --- pkg/config/file.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/config/file.go b/pkg/config/file.go index cc4f373..ee6f089 100644 --- a/pkg/config/file.go +++ b/pkg/config/file.go @@ -2,6 +2,7 @@ package config import ( "encoding/json" + "time" "github.com/pkg/errors" "github.com/spf13/viper" @@ -25,7 +26,9 @@ func NewFileConfig() (Config, error) { return nil, ErrConfigFileNotGiven } - db, err := bolt.Open(path, 0600, nil) + db, err := bolt.Open(path, 0600, &bolt.Options{ + Timeout: 5 * time.Second, + }) if err != nil { return nil, errors.Wrap(err, "could not open database") }