From 7bd121c4123689896d76fe427312f0c3c9f7746f Mon Sep 17 00:00:00 2001 From: Patrick Pfeiffer Date: Wed, 28 Aug 2024 19:19:18 +0200 Subject: [PATCH] (NOBIDS) BEDS-372: improve sendPushNotifications --- services/notifications.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/notifications.go b/services/notifications.go index 55b5077aa1..5a71797242 100644 --- a/services/notifications.go +++ b/services/notifications.go @@ -600,10 +600,17 @@ func sendPushNotifications(useDB *sqlx.DB) error { return fmt.Errorf("error querying notification queue, err: %w", err) } - logger.WithField("notifications", len(notificationQueueItem)).Info("processing push notifications") + totalMessageCount := 0 + for _, n := range notificationQueueItem { + totalMessageCount += len(n.Content.Messages) + } + + logger = logger.WithField("items", len(notificationQueueItem)) + logger = logger.WithField("messages", totalMessageCount) + logger.Info("processing push notifications") start := time.Now() defer func() { - logger.WithField("notifications", len(notificationQueueItem)).WithField("duration", time.Since(start)).Info("processed push notifications") + logger.WithField("duration", time.Since(start)).Info("processed push notifications") }() batchSize := 500