Merge pull request #409 from numtide/feat/bolt-connect-timeout
Some checks failed
gh-pages / build (push) Has been cancelled
golangci-lint / lint (push) Has been cancelled
gh-pages / deploy (push) Has been cancelled

feat: add connect timeout to bolt db
This commit is contained in:
Brian McGee 2024-09-15 03:53:05 +01:00 committed by GitHub
commit e369fcf6aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

3
cache/cache.go vendored
View File

@ -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)
}