mirror of
https://github.com/christianselig/apollo-backend
synced 2024-12-22 22:35:27 +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)
|
||||
}
|
||||
|
||||
func (t *Thing) IsDeleted() bool {
|
||||
return t.Author == "[deleted]"
|
||||
}
|
||||
|
||||
func NewThing(val *fastjson.Value) *Thing {
|
||||
t := &Thing{}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
|
|||
continue
|
||||
}
|
||||
|
||||
if thing.Author != "[deleted]" {
|
||||
if !thing.IsDeleted() {
|
||||
snc.logger.WithFields(logrus.Fields{
|
||||
"account#username": account.NormalizedUsername(),
|
||||
"thing#id": account.LastMessageID,
|
||||
|
@ -203,9 +203,10 @@ func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) {
|
|||
|
||||
account.LastMessageID = ""
|
||||
for _, thing := range things.Children {
|
||||
if lastAlertedAt > thing.CreatedAt {
|
||||
if lastAlertedAt > thing.CreatedAt && !thing.IsDeleted() {
|
||||
break
|
||||
}
|
||||
|
||||
account.LastMessageID = thing.FullName()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue