Skip to content

Commit

Permalink
Merge pull request docker#140 from aboch/to
Browse files Browse the repository at this point in the history
Allow client to set boltdb timeout

Signed-off-by: Santiago Castro <santi.1410@hotmail.com>
  • Loading branch information
Santhosh Manohar authored and bryant1410 committed Apr 18, 2017
2 parents 3fce6a0 + 1720c98 commit 4571a30
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.5.3
- 1.7.1

# let us have speedy Docker-based Travis workers
sudo: false
Expand Down
7 changes: 6 additions & 1 deletion store/boltdb/boltdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func New(endpoints []string, options *store.Config) (store.Store, error) {
db *bolt.DB
err error
boltOptions *bolt.Options
timeout = transientTimeout
)

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

if options.ConnectionTimeout != 0 {
timeout = options.ConnectionTimeout
}

b := &BoltDB{
client: db,
path: endpoints[0],
boltBucket: []byte(options.Bucket),
timeout: transientTimeout,
timeout: timeout,
PersistConnection: options.PersistConnection,
}

Expand Down

0 comments on commit 4571a30

Please sign in to comment.