Skip to content

Commit c131adc

Browse files
committed
feat: add connect timeout to bolt db
Closes #406 Signed-off-by: Brian McGee <[email protected]>
1 parent 985fdfe commit c131adc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cache/cache.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ func Open(treeRoot string, clean bool, formatters map[string]*format.Formatter)
5858
return fmt.Errorf("could not resolve local path for the cache: %w", err)
5959
}
6060

61-
db, err = bolt.Open(path, 0o600, nil)
61+
// attempt to open the db, but timeout after 1 second
62+
db, err = bolt.Open(path, 0o600, &bolt.Options{Timeout: 1 * time.Second})
6263
if err != nil {
6364
return fmt.Errorf("failed to open cache at %v: %w", path, err)
6465
}

0 commit comments

Comments
 (0)