Put timeout on opening bolt
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
@@ -25,7 +26,9 @@ type BoltDB struct {
|
||||
|
||||
func NewBoltDB() *BoltDB {
|
||||
config := config.New()
|
||||
db, err := bolt.Open(config.DBURI, os.ModePerm, nil)
|
||||
db, err := bolt.Open(config.DBURI, os.ModePerm, &bolt.Options{
|
||||
Timeout: time.Second * 3,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user