mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 03:37:43 +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)
|
||||
if err != nil {
|
||||
logger.Error("failed to fetch account devices", zap.Error(err))
|
||||
|
|
Loading…
Reference in a new issue