mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-29 07:07: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 {
|
if things.Count > 0 {
|
||||||
for _, thing := range things.Children {
|
for _, thing := range things.Children {
|
||||||
if thing.FullName() != account.LastMessageID {
|
if thing.FullName() != account.LastMessageID {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
lastAlertedAt = thing.CreatedAt
|
|
||||||
|
|
||||||
if !thing.IsDeleted() {
|
if !thing.IsDeleted() {
|
||||||
snc.logger.WithFields(logrus.Fields{
|
snc.logger.WithFields(logrus.Fields{
|
||||||
"account#username": account.NormalizedUsername(),
|
"account#username": account.NormalizedUsername(),
|
||||||
|
@ -191,6 +187,10 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
|
||||||
}).Info("thing got deleted, resetting")
|
}).Info("thing got deleted, resetting")
|
||||||
|
|
||||||
if kind != "t4" {
|
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()
|
things, err = rac.MessageInbox()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
snc.logger.WithFields(logrus.Fields{
|
snc.logger.WithFields(logrus.Fields{
|
||||||
|
@ -202,19 +202,21 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
|
||||||
}
|
}
|
||||||
|
|
||||||
account.LastMessageID = ""
|
account.LastMessageID = ""
|
||||||
|
|
||||||
|
snc.logger.WithFields(logrus.Fields{
|
||||||
|
"account#username": account.NormalizedUsername(),
|
||||||
|
}).Debug("calculating last good thing")
|
||||||
for _, thing := range things.Children {
|
for _, thing := range things.Children {
|
||||||
if thing.IsDeleted() {
|
if thing.IsDeleted() {
|
||||||
|
snc.logger.WithFields(logrus.Fields{
|
||||||
|
"account#username": account.NormalizedUsername(),
|
||||||
|
"thing#id": thing.FullName(),
|
||||||
|
}).Debug("thing deleted, next")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if lastAlertedAt == 0 {
|
account.LastMessageID = thing.FullName()
|
||||||
account.LastMessageID = thing.FullName()
|
break
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if lastAlertedAt > thing.CreatedAt {
|
|
||||||
account.LastMessageID = thing.FullName()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snc.logger.WithFields(logrus.Fields{
|
snc.logger.WithFields(logrus.Fields{
|
||||||
|
|
Loading…
Reference in a new issue