From d75d0c9c5e2367385ed38bf7afd824f8b0f1041d Mon Sep 17 00:00:00 2001 From: Wai Sing Yiu <89925410+waisingyiu@users.noreply.github.com> Date: Thu, 29 Feb 2024 14:00:53 +0000 Subject: [PATCH] Revert "LIVE-6160 Upgrade firebase to v9.2.0" --- build.sbt | 2 +- .../com/gu/notifications/worker/delivery/fcm/FcmClient.scala | 2 +- .../com/gu/notifications/worker/tokens/TokenService.scala | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 73d0d2aa8..7558160b8 100644 --- a/build.sbt +++ b/build.sbt @@ -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.2.0", + "com.google.firebase" % "firebase-admin" % "9.1.1", "com.google.protobuf" % "protobuf-java" % "3.25.3", "com.amazonaws" % "aws-lambda-java-events" % "2.2.9", "com.amazonaws" % "aws-java-sdk-sqs" % awsSdkVersion, diff --git a/notificationworkerlambda/src/main/scala/com/gu/notifications/worker/delivery/fcm/FcmClient.scala b/notificationworkerlambda/src/main/scala/com/gu/notifications/worker/delivery/fcm/FcmClient.scala index 14b0f7322..5dc92db57 100644 --- a/notificationworkerlambda/src/main/scala/com/gu/notifications/worker/delivery/fcm/FcmClient.scala +++ b/notificationworkerlambda/src/main/scala/com/gu/notifications/worker/delivery/fcm/FcmClient.scala @@ -99,7 +99,7 @@ class FcmClient (firebaseMessaging: FirebaseMessaging, firebaseApp: FirebaseApp, import FirebaseHelpers._ val start = Instant.now firebaseMessaging - .sendEachForMulticastAsync(message) + .sendMulticastAsync(message) .asScala .onComplete { response => val requestCompletionTime = Instant.now 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 888b07542..6d3572227 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,9 +17,6 @@ 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 }