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 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{ snc.logger.WithFields(logrus.Fields{
"account#username": account.NormalizedUsername(), "account#username": account.NormalizedUsername(),
"thing#id": account.LastMessageID, "thing#id": account.LastMessageID,
@ -183,7 +202,6 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
return return
} }
} }
}
snc.logger.WithFields(logrus.Fields{ snc.logger.WithFields(logrus.Fields{
"account#username": account.NormalizedUsername(), "account#username": account.NormalizedUsername(),