diff --git a/userapi/consumers/clientapi.go b/userapi/consumers/clientapi.go index 62098fb37..17d19f5f3 100644 --- a/userapi/consumers/clientapi.go +++ b/userapi/consumers/clientapi.go @@ -105,14 +105,14 @@ func (s *OutputReceiptEventConsumer) onMessage(ctx context.Context, msgs []*nats return false } - if !updated { - return true - } - if err = s.syncProducer.GetAndSendNotificationData(ctx, userID, roomID); err != nil { log.WithError(err).Error("userapi EDU consumer: GetAndSendNotificationData failed") return false } + + if !updated { + return true + } if err = util.NotifyUserCountsAsync(ctx, s.pgClient, localpart, s.db); err != nil { log.WithError(err).Error("userapi EDU consumer: NotifyUserCounts failed") return false diff --git a/userapi/internal/api.go b/userapi/internal/api.go index 98f24ff6e..a9a8c30ac 100644 --- a/userapi/internal/api.go +++ b/userapi/internal/api.go @@ -112,15 +112,17 @@ func (a *UserInternalAPI) setFullyRead(ctx context.Context, req *api.InputAccoun logrus.WithError(err).Errorf("UserInternalAPI.setFullyRead: DeleteNotificationsUpTo failed") return err } - // nothing changed, no need to send notification data/notify push gateway - if !deleted { - return nil - } if err = a.SyncProducer.GetAndSendNotificationData(ctx, req.UserID, req.RoomID); err != nil { logrus.WithError(err).Error("UserInternalAPI.setFullyRead: GetAndSendNotificationData failed") return err } + + // nothing changed, no need to notify the push gateway + if !deleted { + return nil + } + if err = userapiUtil.NotifyUserCountsAsync(ctx, a.PgClient, localpart, a.DB); err != nil { logrus.WithError(err).Error("UserInternalAPI.setFullyRead: NotifyUserCounts failed") return err