diff --git a/notifications/notifications.go b/notifications/notifications.go index f500602d2104a653fbef6857860d24ba5a2e3a77..6bc04e6c327867da00175c0d1d7adf096c5bf436 100644 --- a/notifications/notifications.go +++ b/notifications/notifications.go @@ -11,6 +11,7 @@ package notifications import ( "encoding/base64" "gitlab.com/elixxir/notifications-bot/notifications/apns" + "sync" // "github.com/jonahh-yeti/apns" "github.com/pkg/errors" @@ -65,6 +66,7 @@ type Impl struct { fcm *firebase.FirebaseComm apnsClient *apns.ApnsComm receivedNdf *uint32 + roundStore sync.Map ndfStopper Stopper } @@ -333,6 +335,13 @@ func (nb *Impl) ReceiveNotificationBatch(notifBatch *pb.NotificationBatch, auth // return errors.New("Cannot receive notification data: client is not authenticated") //} + rid := notifBatch.RoundID + + _, loaded := nb.roundStore.LoadOrStore(rid, true) + if loaded { + return nil + } + jww.INFO.Printf("Received notification batch for round %+v", notifBatch.RoundID) for _, notifData := range notifBatch.GetNotifications() {