Skip to content

Commit

Permalink
fix(kv): set timeout for bolt db
Browse files Browse the repository at this point in the history
  • Loading branch information
iyear committed Aug 30, 2022
1 parent 807875e commit 23ffb81
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/storage/kv/bolt/bolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/mitchellh/mapstructure"
"go.etcd.io/bbolt"
"os"
"time"
)

type Options struct {
Expand Down Expand Up @@ -35,7 +36,11 @@ func New(options map[string]interface{}) (*Bolt, error) {
return nil, err
}

db, err := bbolt.Open(ops.Path, os.ModePerm, bbolt.DefaultOptions)
db, err := bbolt.Open(ops.Path, os.ModePerm, &bbolt.Options{
Timeout: time.Second,
NoGrowSync: false,
FreelistType: bbolt.FreelistArrayType,
})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 23ffb81

Please sign in to comment.