Skip to content

Commit

Permalink
Merge pull request #891 from rsteube/cache-allow-zero
Browse files Browse the repository at this point in the history
cache: allow zero timeout duration
  • Loading branch information
rsteube authored Aug 9, 2023
2 parents bd350ea + f658112 commit dcdcfa9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func Write(file string, e export.Export) (err error) {
// Load loads values from file unless modification date exceeds timeout.
func Load(file string, timeout time.Duration) (e export.Export, err error) {
var stat os.FileInfo
if stat, err = os.Stat(file); os.IsNotExist(err) || (timeout > 0 && stat.ModTime().Add(timeout).Before(time.Now())) {
if stat, err = os.Stat(file); os.IsNotExist(err) || (timeout >= 0 && stat.ModTime().Add(timeout).Before(time.Now())) {
err = errors.New("not exists or timeout exceeded")
} else {
var content []byte
Expand Down

0 comments on commit dcdcfa9

Please sign in to comment.