From 4f34e3927bc43d49daa89ee67ae60a0384c0a0af Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 25 May 2022 19:44:29 -0400 Subject: [PATCH] add a bit of breathing room for token refresh --- internal/worker/notifications.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/worker/notifications.go b/internal/worker/notifications.go index d4538bd..1c11a68 100644 --- a/internal/worker/notifications.go +++ b/internal/worker/notifications.go @@ -178,7 +178,7 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) { }(&account) rac := nc.reddit.NewAuthenticatedClient(account.AccountID, account.RefreshToken, account.AccessToken) - if account.TokenExpiresAt.Before(now) { + if account.TokenExpiresAt.Before(now.Add(1 * time.Minute)) { nc.logger.Debug("refreshing reddit token", zap.Int64("account#id", id), zap.String("account#username", account.NormalizedUsername()),