Skip to content

Commit

Permalink
Add open db timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
eirsyl committed Mar 5, 2019
1 parent e280b3c commit 591ee90
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/config/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package config

import (
"encoding/json"
"time"

"github.com/pkg/errors"
"github.com/spf13/viper"
Expand All @@ -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")
}
Expand Down

0 comments on commit 591ee90

Please sign in to comment.