Skip to content

Commit

Permalink
(NOBIDS) BEDS-372: improve sendPushNotifications
Browse files Browse the repository at this point in the history
  • Loading branch information
guybrush committed Aug 28, 2024
1 parent dbc0b0d commit 7bd121c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions services/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7bd121c

Please sign in to comment.