mirror of
https://github.com/openziti/ziti.git
synced 2026-10-13 15:51:21 +00:00
Merge pull request openziti/fabric#105 from openziti/dont-wait-forever-for-db-lock
Don't wait forever for a DB lock
This commit is contained in:
+5
-1
@@ -30,7 +30,11 @@ type Db struct {
|
||||
}
|
||||
|
||||
func Open(path string) (*Db, error) {
|
||||
db, err := bbolt.Open(path, 0600, nil)
|
||||
// Only wait 1 second if database file can't be locked, as it most likely means another controller is running
|
||||
options := *bbolt.DefaultOptions
|
||||
options.Timeout = time.Second
|
||||
|
||||
db, err := bbolt.Open(path, 0600, &options)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to open controller database [%s] (%s)", path, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user