commit 41915ab371cbbab8f0e823b3c3292b74a4d85af7
parent 3363e0ebdd2ad8bde458037b82432bc3dd93adde
Author: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>
Date: Sun, 9 May 2021 14:28:43 +0200
Fix token sweep (#19)
* fix token sweep not working
* change sweep message to trace
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git 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
}
}