mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 21:27:42 +00:00
check for last alerted thing that wasn't deleted
This commit is contained in:
parent
ad982edcd7
commit
78e48a8f3b
2 changed files with 7 additions and 2 deletions
|
@ -85,6 +85,10 @@ func (t *Thing) FullName() string {
|
||||||
return fmt.Sprintf("%s_%s", t.Kind, t.ID)
|
return fmt.Sprintf("%s_%s", t.Kind, t.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Thing) IsDeleted() bool {
|
||||||
|
return t.Author == "[deleted]"
|
||||||
|
}
|
||||||
|
|
||||||
func NewThing(val *fastjson.Value) *Thing {
|
func NewThing(val *fastjson.Value) *Thing {
|
||||||
t := &Thing{}
|
t := &Thing{}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if thing.Author != "[deleted]" {
|
if !thing.IsDeleted() {
|
||||||
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,
|
||||||
|
@ -203,9 +203,10 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
|
||||||
|
|
||||||
account.LastMessageID = ""
|
account.LastMessageID = ""
|
||||||
for _, thing := range things.Children {
|
for _, thing := range things.Children {
|
||||||
if lastAlertedAt > thing.CreatedAt {
|
if lastAlertedAt > thing.CreatedAt && !thing.IsDeleted() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
account.LastMessageID = thing.FullName()
|
account.LastMessageID = thing.FullName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue