From 14f46806cdde2fc9e00402f249fb392506b73f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20H=C3=A5rek=20Andreassen?= Date: Wed, 6 Nov 2024 16:01:40 +0100 Subject: [PATCH] cache: Simplify expires MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim HĂ„rek Andreassen --- pkg/cache/cache.go | 2 +- pkg/cache/cache_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cache/cache.go b/pkg/cache/cache.go index 9b908bf..eb02574 100644 --- a/pkg/cache/cache.go +++ b/pkg/cache/cache.go @@ -155,5 +155,5 @@ func IsExpired(expire time.Time, now *time.Time) bool { now = &tmp } - return now.Unix() >= expire.Unix() + return now.After(expire) } diff --git a/pkg/cache/cache_test.go b/pkg/cache/cache_test.go index ef6f45d..bbb0ec9 100644 --- a/pkg/cache/cache_test.go +++ b/pkg/cache/cache_test.go @@ -55,7 +55,7 @@ func TestIsExpired(t *testing.T) { assert.NoError(err) result = IsExpired(expirationTime, &now) - assert.True(result) + assert.False(result) now, err = time.Parse(layout, "2024-10-04 22:23:00") assert.NoError(err)