mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 13:17:42 +00:00
more tweaks
This commit is contained in:
parent
b5bc51dfd7
commit
6f2c956082
1 changed files with 14 additions and 12 deletions
|
@ -165,16 +165,12 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
|
|||
}
|
||||
}
|
||||
|
||||
lastAlertedAt := 0.0
|
||||
|
||||
if things.Count > 0 {
|
||||
for _, thing := range things.Children {
|
||||
if thing.FullName() != account.LastMessageID {
|
||||
continue
|
||||
}
|
||||
|
||||
lastAlertedAt = thing.CreatedAt
|
||||
|
||||
if !thing.IsDeleted() {
|
||||
snc.logger.WithFields(logrus.Fields{
|
||||
"account#username": account.NormalizedUsername(),
|
||||
|
@ -191,6 +187,10 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
|
|||
}).Info("thing got deleted, resetting")
|
||||
|
||||
if kind != "t4" {
|
||||
snc.logger.WithFields(logrus.Fields{
|
||||
"account#username": account.NormalizedUsername(),
|
||||
}).Info("getting message inbox to determine last good thing")
|
||||
|
||||
things, err = rac.MessageInbox()
|
||||
if err != nil {
|
||||
snc.logger.WithFields(logrus.Fields{
|
||||
|
@ -202,19 +202,21 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
|
|||
}
|
||||
|
||||
account.LastMessageID = ""
|
||||
|
||||
snc.logger.WithFields(logrus.Fields{
|
||||
"account#username": account.NormalizedUsername(),
|
||||
}).Debug("calculating last good thing")
|
||||
for _, thing := range things.Children {
|
||||
if thing.IsDeleted() {
|
||||
snc.logger.WithFields(logrus.Fields{
|
||||
"account#username": account.NormalizedUsername(),
|
||||
"thing#id": thing.FullName(),
|
||||
}).Debug("thing deleted, next")
|
||||
continue
|
||||
}
|
||||
|
||||
if lastAlertedAt == 0 {
|
||||
account.LastMessageID = thing.FullName()
|
||||
break
|
||||
}
|
||||
|
||||
if lastAlertedAt > thing.CreatedAt {
|
||||
account.LastMessageID = thing.FullName()
|
||||
}
|
||||
account.LastMessageID = thing.FullName()
|
||||
break
|
||||
}
|
||||
|
||||
snc.logger.WithFields(logrus.Fields{
|
||||
|
|
Loading…
Reference in a new issue