edge case for stuck notifications

This commit is contained in:
Andre Medeiros 2022-05-19 12:37:03 -04:00
parent cc6e862ba6
commit 8c5422af20

View file

@ -175,7 +175,26 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
continue
}
if !thing.IsDeleted() {
if thing.IsDeleted() {
break
}
things, err := rac.MessageInbox(snc, reddit.WithQuery("after", account.LastMessageID))
if err != nil {
snc.logger.WithFields(logrus.Fields{
"err": err,
}).Error("failed to check inbox")
return
}
if things.Count == 0 {
snc.logger.WithFields(logrus.Fields{
"account#username": account.NormalizedUsername(),
"thing#id": account.LastMessageID,
}).Debug("thing exists, but not in inbox, marking as deleted")
break
}
snc.logger.WithFields(logrus.Fields{
"account#username": account.NormalizedUsername(),
"thing#id": account.LastMessageID,
@ -183,7 +202,6 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
return
}
}
}
snc.logger.WithFields(logrus.Fields{
"account#username": account.NormalizedUsername(),