cache: Simplify expires
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
parent
358ac49eea
commit
14f46806cd
2 changed files with 2 additions and 2 deletions
2
pkg/cache/cache.go
vendored
2
pkg/cache/cache.go
vendored
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
2
pkg/cache/cache_test.go
vendored
2
pkg/cache/cache_test.go
vendored
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue