From 73ba5e726cc63ec5355f6ce5479dff5b4a9fb13f Mon Sep 17 00:00:00 2001 From: Wai Sing Yiu Date: Thu, 29 Feb 2024 10:49:51 +0000 Subject: [PATCH] Add a comment about the max number of tokens for each multicast API --- .../com/gu/notifications/worker/tokens/TokenService.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/notificationworkerlambda/src/main/scala/com/gu/notifications/worker/tokens/TokenService.scala b/notificationworkerlambda/src/main/scala/com/gu/notifications/worker/tokens/TokenService.scala index 6d3572227..888b07542 100644 --- a/notificationworkerlambda/src/main/scala/com/gu/notifications/worker/tokens/TokenService.scala +++ b/notificationworkerlambda/src/main/scala/com/gu/notifications/worker/tokens/TokenService.scala @@ -17,6 +17,9 @@ case class BatchNotification(notification: Notification, token: List[String]) case class ChunkedTokens(notification: Notification, tokens: List[String], range: ShardRange, metadata: NotificationMetadata) { def toNotificationToSends: List[IndividualNotification] = tokens.map(IndividualNotification(notification, _)) + + // the Firebase sendEachForMulticast API has a maximum limit of 500 tokens for each request + // so this grouping of 500 tokens must not be increased further def toBatchNotificationToSends: List[BatchNotification] = tokens.grouped(500).map(BatchNotification(notification, _)).toList }