mirror of
https://github.com/numtide/treefmt.git
synced 2024-11-20 18:10:21 +03:00
Merge pull request #409 from numtide/feat/bolt-connect-timeout
feat: add connect timeout to bolt db
This commit is contained in:
commit
e369fcf6aa
3
cache/cache.go
vendored
3
cache/cache.go
vendored
@ -58,7 +58,8 @@ func Open(treeRoot string, clean bool, formatters map[string]*format.Formatter)
|
||||
return fmt.Errorf("could not resolve local path for the cache: %w", err)
|
||||
}
|
||||
|
||||
db, err = bolt.Open(path, 0o600, nil)
|
||||
// attempt to open the db, but timeout after 1 second
|
||||
db, err = bolt.Open(path, 0o600, &bolt.Options{Timeout: 1 * time.Second})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open cache at %v: %w", path, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user