remove retry logic with token

This commit is contained in:
Andre Medeiros 2021-07-13 15:21:14 -04:00
parent 0262133ce8
commit fdfa447435

View file

@ -196,9 +196,6 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
return return
} }
retried := false
refreshToken:
rac := nc.reddit.NewAuthenticatedClient(account.RefreshToken, account.AccessToken) rac := nc.reddit.NewAuthenticatedClient(account.RefreshToken, account.AccessToken)
if account.ExpiresAt < int64(now) { if account.ExpiresAt < int64(now) {
nc.logger.WithFields(logrus.Fields{ nc.logger.WithFields(logrus.Fields{
@ -251,13 +248,6 @@ refreshToken:
msgs, err := rac.MessageInbox(account.LastMessageID) msgs, err := rac.MessageInbox(account.LastMessageID)
if err != nil { if err != nil {
// Check if maybe we need to refresh the token.
if !retried {
retried = true
account.ExpiresAt = 0
goto refreshToken
}
nc.logger.WithFields(logrus.Fields{ nc.logger.WithFields(logrus.Fields{
"accountID": id, "accountID": id,
"err": err, "err": err,