cache: Simplify expires

Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
Tim Hårek Andreassen 2024-11-06 16:01:40 +01:00
parent 358ac49eea
commit 14f46806cd
No known key found for this signature in database
GPG key ID: E59C7734F0E10EB5
2 changed files with 2 additions and 2 deletions

2
pkg/cache/cache.go vendored
View file

@ -155,5 +155,5 @@ func IsExpired(expire time.Time, now *time.Time) bool {
now = &tmp now = &tmp
} }
return now.Unix() >= expire.Unix() return now.After(expire)
} }

View file

@ -55,7 +55,7 @@ func TestIsExpired(t *testing.T) {
assert.NoError(err) assert.NoError(err)
result = IsExpired(expirationTime, &now) result = IsExpired(expirationTime, &now)
assert.True(result) assert.False(result)
now, err = time.Parse(layout, "2024-10-04 22:23:00") now, err = time.Parse(layout, "2024-10-04 22:23:00")
assert.NoError(err) assert.NoError(err)