From 41915ab371cbbab8f0e823b3c3292b74a4d85af7 Mon Sep 17 00:00:00 2001 From: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com> Date: Sun, 9 May 2021 14:28:43 +0200 Subject: [PATCH] Fix token sweep (#19) * fix token sweep not working * change sweep message to trace --- internal/oauth/tokenstore.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/oauth/tokenstore.go b/internal/oauth/tokenstore.go index 539890a03..f9654a687 100644 --- a/internal/oauth/tokenstore.go +++ b/internal/oauth/tokenstore.go @@ -56,7 +56,7 @@ func newTokenStore(ctx context.Context, db db.DB, log *logrus.Logger) oauth2.Tok log.Info("breaking cleanloop") break cleanloop case <-time.After(1 * time.Minute): - log.Debug("sweeping out old oauth entries broom broom") + log.Trace("sweeping out old oauth entries broom broom") if err := pts.sweep(); err != nil { log.Errorf("error while sweeping oauth entries: %s", err) } @@ -82,7 +82,7 @@ func (pts *tokenStore) sweep() error { // we only want to check if a token expired before now if the expiry time is *not zero*; // ie., if it's been explicity set. if !pgt.CodeExpiresAt.IsZero() && pgt.CodeExpiresAt.Before(now) || !pgt.RefreshExpiresAt.IsZero() && pgt.RefreshExpiresAt.Before(now) || !pgt.AccessExpiresAt.IsZero() && pgt.AccessExpiresAt.Before(now) { - if err := pts.db.DeleteByID(pgt.ID, &pgt); err != nil { + if err := pts.db.DeleteByID(pgt.ID, pgt); err != nil { return err } }