Browse Source

Honoring ConnectionTimeout in boltdb

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Madhu Venugopal 9 years ago
parent
commit
64eb25dff9
1 changed files with 6 additions and 1 deletions
  1. 6 1
      libnetwork/internal/kvstore/boltdb/boltdb.go

+ 6 - 1
libnetwork/internal/kvstore/boltdb/boltdb.go

@@ -55,7 +55,12 @@ func New(endpoints []string, options *store.Config) (store.Store, error) {
 	if err := os.MkdirAll(dir, 0750); err != nil {
 		return nil, err
 	}
-	db, err := bolt.Open(endpoints[0], 0644, nil)
+
+	var boltOptions *bolt.Options
+	if options != nil {
+		boltOptions = &bolt.Options{Timeout: options.ConnectionTimeout}
+	}
+	db, err := bolt.Open(endpoints[0], 0644, boltOptions)
 	if err != nil {
 		return nil, err
 	}