Skip to content

Commit 1d84310

Browse files
author
Santhosh Manohar
authored
Merge pull request #140 from aboch/to
Allow client to set boltdb timeout
2 parents 3fce6a0 + 1720c98 commit 1d84310

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: go
22

33
go:
4-
- 1.5.3
4+
- 1.7.1
55

66
# let us have speedy Docker-based Travis workers
77
sudo: false

store/boltdb/boltdb.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func New(endpoints []string, options *store.Config) (store.Store, error) {
5959
db *bolt.DB
6060
err error
6161
boltOptions *bolt.Options
62+
timeout = transientTimeout
6263
)
6364

6465
if len(endpoints) > 1 {
@@ -82,11 +83,15 @@ func New(endpoints []string, options *store.Config) (store.Store, error) {
8283
}
8384
}
8485

86+
if options.ConnectionTimeout != 0 {
87+
timeout = options.ConnectionTimeout
88+
}
89+
8590
b := &BoltDB{
8691
client: db,
8792
path: endpoints[0],
8893
boltBucket: []byte(options.Bucket),
89-
timeout: transientTimeout,
94+
timeout: timeout,
9095
PersistConnection: options.PersistConnection,
9196
}
9297

0 commit comments

Comments
 (0)