mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 13:17:42 +00:00
spam prevention
This commit is contained in:
parent
af538e6f42
commit
4f200fd26a
1 changed files with 9 additions and 0 deletions
|
@ -263,6 +263,15 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Let's populate this with the latest message so we don't flood users with stuff
|
||||||
|
if account.CheckCount == 0 {
|
||||||
|
logger.Debug("populating first message id to prevent spamming")
|
||||||
|
|
||||||
|
account.CheckCount = 1
|
||||||
|
_ = nc.accountRepo.Update(ctx, &account)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
devices, err := nc.deviceRepo.GetInboxNotifiableByAccountID(ctx, account.ID)
|
devices, err := nc.deviceRepo.GetInboxNotifiableByAccountID(ctx, account.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("failed to fetch account devices", zap.Error(err))
|
logger.Error("failed to fetch account devices", zap.Error(err))
|
||||||
|
|
Loading…
Reference in a new issue