Skip to content

Commit

Permalink
Merge pull request #1206 from guardian/LIVE-6160-upgrade-firebase-v9_2_0
Browse files Browse the repository at this point in the history
LIVE-6160 Upgrade firebase to v9.2.0
  • Loading branch information
waisingyiu authored Feb 29, 2024
2 parents 9894b5f + 73ba5e7 commit dac5a7d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ lazy val notificationworkerlambda = lambda("notificationworkerlambda", "notifica
dockerAlias := DockerAlias(registryHost = dockerRepository.value, username = None, name = (Docker / packageName).value, tag = buildNumber),
libraryDependencies ++= Seq(
"com.turo" % "pushy" % "0.13.10",
"com.google.firebase" % "firebase-admin" % "9.1.1",
"com.google.firebase" % "firebase-admin" % "9.2.0",
"com.google.protobuf" % "protobuf-java" % "3.25.3",
"com.amazonaws" % "aws-lambda-java-events" % "2.2.9",
"com.amazonaws" % "aws-java-sdk-sqs" % awsSdkVersion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class FcmClient (firebaseMessaging: FirebaseMessaging, firebaseApp: FirebaseApp,
import FirebaseHelpers._
val start = Instant.now
firebaseMessaging
.sendMulticastAsync(message)
.sendEachForMulticastAsync(message)
.asScala
.onComplete { response =>
val requestCompletionTime = Instant.now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit dac5a7d

Please sign in to comment.