Skip to content

Commit

Permalink
feat: add connect timeout to bolt db
Browse files Browse the repository at this point in the history
Closes #406

Signed-off-by: Brian McGee <[email protected]>
  • Loading branch information
brianmcgee committed Sep 14, 2024
1 parent 985fdfe commit c131adc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit c131adc

Please sign in to comment.