From 5c0b8314355e9a3ad1d722bd2cc970a6d8e3b52d Mon Sep 17 00:00:00 2001 From: Daniel Clifton <110032454+DanielCliftonGuardian@users.noreply.github.com> Date: Fri, 29 Sep 2023 10:33:23 +0100 Subject: [PATCH] refactor(akka): update config and refactor names (#26602) * update akka config * add logger path --------- Co-authored-by: Charlotte --- admin/app/AppLoader.scala | 2 +- admin/app/controllers/AdminControllers.scala | 4 ++-- .../app/controllers/FrontPressController.scala | 12 ++++++------ .../admin/InteractiveLibrarianController.scala | 4 ++-- .../controllers/admin/R2PressController.scala | 8 ++++---- .../admin/SwitchboardController.scala | 4 ++-- admin/app/dfp/DfpAdUnitCacheJob.scala | 6 +++--- admin/app/dfp/DfpDataCacheLifecycle.scala | 10 +++++----- admin/app/jobs/CommercialDfpReporting.scala | 4 ++-- admin/app/jobs/RefreshFrontsJob.scala | 12 +++++++----- admin/app/model/AdminLifecycle.scala | 11 ++++++----- admin/app/services/EmailService.scala | 10 +++++----- admin/app/services/R2PagePressNotifier.scala | 6 +++--- .../R2PressedPageTakedownNotifier.scala | 6 +++--- admin/conf/application.conf | 5 +++-- applications/app/jobs/SitemapLifecycle.scala | 7 ++++--- applications/conf/application.conf | 4 ++-- archive/conf/application.conf | 4 ++-- article/app/jobs/MessageUsLifecycle.scala | 6 +++--- article/app/jobs/TopicLifecycle.scala | 6 +++--- article/conf/application.conf | 4 ++-- build.sbt | 1 + commercial/app/CommercialLifecycle.scala | 6 +++--- .../model/merchandise/books/BookFinder.scala | 4 ++-- commercial/conf/application.conf | 4 ++-- common/app/app/FrontendApplicationLoader.scala | 2 +- .../targeting/TargetingLifecycle.scala | 6 +++--- common/app/common/Logback/KinesisAdapter.scala | 2 +- common/app/common/akka.scala | 2 +- common/app/common/dfp/DfpAgentLifecycle.scala | 10 +++++----- common/app/concurrent/BlockingOperations.scala | 2 +- common/app/conf/HealthCheck.scala | 4 ++-- .../conf/switches/SwitchboardLifecycle.scala | 6 +++--- common/app/conf/switches/Switches.scala | 4 ++-- .../contentapi/SectionsLookUpLifecycle.scala | 4 ++-- common/app/http/Filters.scala | 2 +- common/app/services/ConfigAgentTrait.scala | 4 ++-- common/app/services/Notification.scala | 18 +++++++++--------- .../services/ophan/SurgingContentAgent.scala | 4 ++-- common/conf/application.conf | 2 +- common/conf/test.conf | 2 +- dev-build/conf/dev-build.application.conf | 4 ++-- discussion/conf/application.conf | 4 ++-- facia-press/conf/application.conf | 4 ++-- facia/app/feed/DeeplyReadLifecycle.scala | 6 +++--- facia/app/feed/MostViewedLifecycle.scala | 6 +++--- facia/conf/application.conf | 4 ++-- identity/app/conf/IdentityLifecycle.scala | 6 +++--- identity/conf/application.conf | 4 ++-- onward/app/feed/OnwardJourneyLifecycle.scala | 6 +++--- onward/conf/application.conf | 4 ++-- preview/conf/application.conf | 4 ++-- project/Dependencies.scala | 1 + rss/conf/application.conf | 4 ++-- sport/app/cricket/conf/context.scala | 6 +++--- sport/app/football/conf/context.scala | 4 ++-- sport/app/rugby/conf/RugbyLifecycle.scala | 8 ++++---- sport/conf/application.conf | 4 ++-- 58 files changed, 155 insertions(+), 148 deletions(-) diff --git a/admin/app/AppLoader.scala b/admin/app/AppLoader.scala index c47ff78e856..cf41722fb59 100644 --- a/admin/app/AppLoader.scala +++ b/admin/app/AppLoader.scala @@ -35,7 +35,7 @@ class AppLoader extends FrontendApplicationLoader { trait AdminServices extends I18nComponents { def wsClient: WSClient - def akkaAsync: AkkaAsync + def pekkoAsync: PekkoAsync def pekkoActorSystem: PekkoActorSystem implicit val executionContext: ExecutionContext lazy val capiHttpClient: HttpClient = wire[CapiHttpClient] diff --git a/admin/app/controllers/AdminControllers.scala b/admin/app/controllers/AdminControllers.scala index 664119afaef..1e11c157a3e 100644 --- a/admin/app/controllers/AdminControllers.scala +++ b/admin/app/controllers/AdminControllers.scala @@ -1,6 +1,6 @@ package controllers import com.softwaremill.macwire._ -import common.AkkaAsync +import common.PekkoAsync import controllers.admin._ import controllers.admin.commercial._ import controllers.cache.{ImageDecacheController, PageDecacheController} @@ -12,7 +12,7 @@ import play.api.mvc.ControllerComponents import services.{OphanApi, ParameterStoreService, RedirectService} trait AdminControllers { - def akkaAsync: AkkaAsync + def pekkoAsync: PekkoAsync def wsClient: WSClient def ophanApi: OphanApi implicit def appContext: ApplicationContext diff --git a/admin/app/controllers/FrontPressController.scala b/admin/app/controllers/FrontPressController.scala index 1f74bfd502b..f8881eb2b07 100644 --- a/admin/app/controllers/FrontPressController.scala +++ b/admin/app/controllers/FrontPressController.scala @@ -1,11 +1,11 @@ package controllers -import common.{AkkaAsync, ImplicitControllerExecutionContext, GuLogging} +import common.{PekkoAsync, ImplicitControllerExecutionContext, GuLogging} import jobs.{HighFrequency, LowFrequency, RefreshFrontsJob, StandardFrequency} import model.ApplicationContext import play.api.mvc._ -class FrontPressController(akkaAsync: AkkaAsync, val controllerComponents: ControllerComponents)(implicit +class FrontPressController(pekkoAsync: PekkoAsync, val controllerComponents: ControllerComponents)(implicit context: ApplicationContext, ) extends BaseController with GuLogging @@ -18,7 +18,7 @@ class FrontPressController(akkaAsync: AkkaAsync, val controllerComponents: Contr def queueAllFrontsForPress(): Action[AnyContent] = Action { implicit request => - RefreshFrontsJob.runAll(akkaAsync) match { + RefreshFrontsJob.runAll(pekkoAsync) match { case Some(l) => Ok(s"Pushed ${l.length} fronts to the SQS queue") case None => InternalServerError("Could not push to the SQS queue, is there an SNS topic set? (frontPressSns)") } @@ -26,17 +26,17 @@ class FrontPressController(akkaAsync: AkkaAsync, val controllerComponents: Contr def queueHighFrequencyFrontsForPress(): Action[AnyContent] = Action { implicit request => - runJob(RefreshFrontsJob.runFrequency(akkaAsync)(HighFrequency), "high frequency") + runJob(RefreshFrontsJob.runFrequency(pekkoAsync)(HighFrequency), "high frequency") } def queueStandardFrequencyFrontsForPress(): Action[AnyContent] = Action { implicit request => - runJob(RefreshFrontsJob.runFrequency(akkaAsync)(StandardFrequency), "standard frequency") + runJob(RefreshFrontsJob.runFrequency(pekkoAsync)(StandardFrequency), "standard frequency") } def queueLowFrequencyFrontsForPress(): Action[AnyContent] = Action { implicit request => - runJob(RefreshFrontsJob.runFrequency(akkaAsync)(LowFrequency), "low frequency") + runJob(RefreshFrontsJob.runFrequency(pekkoAsync)(LowFrequency), "low frequency") } private def runJob(didRun: Boolean, jobName: String): Result = { diff --git a/admin/app/controllers/admin/InteractiveLibrarianController.scala b/admin/app/controllers/admin/InteractiveLibrarianController.scala index 9c291289bb3..add04d8c653 100644 --- a/admin/app/controllers/admin/InteractiveLibrarianController.scala +++ b/admin/app/controllers/admin/InteractiveLibrarianController.scala @@ -1,6 +1,6 @@ package controllers.admin -import common.{AkkaAsync, GuLogging, ImplicitControllerExecutionContext} +import common.{PekkoAsync, GuLogging, ImplicitControllerExecutionContext} import conf.switches.Switches.ContentPresser import model.ApplicationContext import play.api.libs.ws.WSClient @@ -11,7 +11,7 @@ import scala.concurrent.Future class InteractiveLibrarianController( wsClient: WSClient, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, val controllerComponents: ControllerComponents, )(implicit context: ApplicationContext) extends BaseController diff --git a/admin/app/controllers/admin/R2PressController.scala b/admin/app/controllers/admin/R2PressController.scala index 87bbf321ce7..1d35cbc108a 100644 --- a/admin/app/controllers/admin/R2PressController.scala +++ b/admin/app/controllers/admin/R2PressController.scala @@ -1,6 +1,6 @@ package controllers.admin -import common.{AkkaAsync, GuLogging, ImplicitControllerExecutionContext} +import common.{PekkoAsync, GuLogging, ImplicitControllerExecutionContext} import model.{ApplicationContext, R2PressMessage} import play.api.mvc._ import services.{R2PagePressNotifier, R2PressedPageTakedownNotifier, RedirectService} @@ -10,7 +10,7 @@ import java.net.URL import scala.util.Try class R2PressController( - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, val controllerComponents: ControllerComponents, )(implicit context: ApplicationContext) extends BaseController @@ -90,7 +90,7 @@ class R2PressController( private def normaliseAndEnqueueTakedown(url: String): String = { getVariations(url) match { - case Some(urls) => urls.map(u => R2PressedPageTakedownNotifier.enqueue(akkaAsync)(u)).mkString("\n") + case Some(urls) => urls.map(u => R2PressedPageTakedownNotifier.enqueue(pekkoAsync)(u)).mkString("\n") case None => s"$url not recognised as a valid url." } } @@ -98,7 +98,7 @@ class R2PressController( def normaliseAndEnqueuePress(message: R2PressMessage): String = { val tryUrl = RedirectService.normaliseURL(message.url) tryUrl match { - case Some(url) => R2PagePressNotifier.enqueue(akkaAsync)(message.copy(url = url)) + case Some(url) => R2PagePressNotifier.enqueue(pekkoAsync)(message.copy(url = url)) case None => s"${message.url} not recognised as a valid url." } } diff --git a/admin/app/controllers/admin/SwitchboardController.scala b/admin/app/controllers/admin/SwitchboardController.scala index 80b9c02bf1d..927a84eac58 100644 --- a/admin/app/controllers/admin/SwitchboardController.scala +++ b/admin/app/controllers/admin/SwitchboardController.scala @@ -11,7 +11,7 @@ import tools.Store import scala.concurrent.Future -class SwitchboardController(akkaAsync: AkkaAsync, val controllerComponents: ControllerComponents)(implicit +class SwitchboardController(pekkoAsync: PekkoAsync, val controllerComponents: ControllerComponents)(implicit context: ApplicationContext, ) extends BaseController with GuLogging @@ -80,7 +80,7 @@ class SwitchboardController(akkaAsync: AkkaAsync, val controllerComponents: Cont log.info("switches successfully updated") val changes = updates filterNot { current contains _ } - SwitchNotification.onSwitchChanges(akkaAsync)(requester, Configuration.environment.stage, changes) + SwitchNotification.onSwitchChanges(pekkoAsync)(requester, Configuration.environment.stage, changes) changes foreach { change => log.info(s"Switch change by $requester: $change") } diff --git a/admin/app/dfp/DfpAdUnitCacheJob.scala b/admin/app/dfp/DfpAdUnitCacheJob.scala index 7f97c66360f..64567715abb 100644 --- a/admin/app/dfp/DfpAdUnitCacheJob.scala +++ b/admin/app/dfp/DfpAdUnitCacheJob.scala @@ -1,6 +1,6 @@ package dfp -import common.{AkkaAsync, GuLogging} +import common.{PekkoAsync, GuLogging} import conf.Configuration import tools.Store @@ -8,9 +8,9 @@ import scala.concurrent.{ExecutionContext, Future} class DfpAdUnitCacher(val rootAdUnit: Any, val filename: String, dfpApi: DfpApi) extends GuLogging { - def run(akkaAsync: AkkaAsync)(implicit executionContext: ExecutionContext): Future[Unit] = + def run(pekkoAsync: PekkoAsync)(implicit executionContext: ExecutionContext): Future[Unit] = Future { - akkaAsync { + pekkoAsync { val adUnits = dfpApi.readActiveAdUnits(rootAdUnit.toString) if (adUnits.nonEmpty) { val rows = adUnits.map(adUnit => s"${adUnit.id},${adUnit.path.mkString(",")}") diff --git a/admin/app/dfp/DfpDataCacheLifecycle.scala b/admin/app/dfp/DfpDataCacheLifecycle.scala index 1475e3d494c..22a5e4f7066 100644 --- a/admin/app/dfp/DfpDataCacheLifecycle.scala +++ b/admin/app/dfp/DfpDataCacheLifecycle.scala @@ -23,7 +23,7 @@ class DfpDataCacheLifecycle( dfpMobileAppAdUnitCacheJob: DfpMobileAppAdUnitCacheJob, dfpFacebookIaAdUnitCacheJob: DfpFacebookIaAdUnitCacheJob, dfpTemplateCreativeCacheJob: DfpTemplateCreativeCacheJob, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, )(implicit ec: ExecutionContext) extends LifecycleComponent { @@ -75,17 +75,17 @@ class DfpDataCacheLifecycle( new Job[Unit] { val name: String = "DFP-Ad-Units-Update" val interval: Int = 60 - def run(): Future[Unit] = dfpAdUnitCacheJob.run(akkaAsync) + def run(): Future[Unit] = dfpAdUnitCacheJob.run(pekkoAsync) }, new Job[Unit] { val name: String = "DFP-Mobile-Apps-Ad-Units-Update" val interval: Int = 60 - def run(): Future[Unit] = dfpMobileAppAdUnitCacheJob.run(akkaAsync) + def run(): Future[Unit] = dfpMobileAppAdUnitCacheJob.run(pekkoAsync) }, new Job[Unit] { val name: String = "DFP-Facebook-IA-Ad-Units-Update" val interval: Int = 60 - def run(): Future[Unit] = dfpFacebookIaAdUnitCacheJob.run(akkaAsync) + def run(): Future[Unit] = dfpFacebookIaAdUnitCacheJob.run(pekkoAsync) }, new Job[Seq[GuCreativeTemplate]] { val name: String = "DFP-Creative-Templates-Update" @@ -114,7 +114,7 @@ class DfpDataCacheLifecycle( } } - akkaAsync.after1s { + pekkoAsync.after1s { dfpDataCacheJob.refreshAllDfpData() creativeTemplateAgent.refresh() dfpTemplateCreativeCacheJob.run() diff --git a/admin/app/jobs/CommercialDfpReporting.scala b/admin/app/jobs/CommercialDfpReporting.scala index a5f5e71dbcf..dd62003f14d 100644 --- a/admin/app/jobs/CommercialDfpReporting.scala +++ b/admin/app/jobs/CommercialDfpReporting.scala @@ -7,7 +7,7 @@ import com.google.api.ads.admanager.axis.v202308.Column.{AD_SERVER_IMPRESSIONS, import com.google.api.ads.admanager.axis.v202308.DateRangeType.CUSTOM_DATE import com.google.api.ads.admanager.axis.v202308.Dimension.{CUSTOM_CRITERIA, DATE} import com.google.api.ads.admanager.axis.v202308._ -import common.{AkkaAsync, Box, JobScheduler, GuLogging} +import common.{PekkoAsync, Box, JobScheduler, GuLogging} import dfp.DfpApi import play.api.inject.ApplicationLifecycle @@ -86,7 +86,7 @@ object CommercialDfpReporting extends GuLogging { class CommercialDfpReportingLifecycle( appLifecycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, dfpApi: DfpApi, )(implicit ec: ExecutionContext) extends LifecycleComponent diff --git a/admin/app/jobs/RefreshFrontsJob.scala b/admin/app/jobs/RefreshFrontsJob.scala index 7a80aa0de9d..d3d7e5217e1 100644 --- a/admin/app/jobs/RefreshFrontsJob.scala +++ b/admin/app/jobs/RefreshFrontsJob.scala @@ -1,7 +1,7 @@ package jobs import com.gu.facia.api.models.{CommercialPriority, EditorialPriority, EmailPriority, TrainingPriority} -import common.{AkkaAsync, GuLogging} +import common.{PekkoAsync, GuLogging} import conf.Configuration import services.{ConfigAgent, FrontPressNotification} @@ -36,12 +36,14 @@ object RefreshFrontsJob extends GuLogging { } } - def runFrequency(akkaAsync: AkkaAsync)(frontType: FrontType)(implicit executionContext: ExecutionContext): Boolean = { + def runFrequency( + pekkoAsync: PekkoAsync, + )(frontType: FrontType)(implicit executionContext: ExecutionContext): Boolean = { if (Configuration.aws.frontPressSns.exists(_.nonEmpty)) { log.info(s"Putting press jobs on Facia Cron $frontType") for (update <- getAllCronUpdates.filter(_.frontType == frontType)) { log.info(s"Pressing $update") - FrontPressNotification.sendWithoutSubject(akkaAsync)(update.path) + FrontPressNotification.sendWithoutSubject(pekkoAsync)(update.path) } true } else { @@ -52,13 +54,13 @@ object RefreshFrontsJob extends GuLogging { //This is used by a route in admin to push ALL paths to the facia-press SQS queue. //The facia-press boxes will start to pick these off one by one, so there is no direct overloading of these boxes - def runAll(akkaAsync: AkkaAsync)(implicit executionContext: ExecutionContext): Option[Seq[Unit]] = { + def runAll(pekkoAsync: PekkoAsync)(implicit executionContext: ExecutionContext): Option[Seq[Unit]] = { Configuration.aws.frontPressSns.map(Function.const { log.info("Putting press jobs on Facia Cron (MANUAL REQUEST)") for (update <- getAllCronUpdates) yield { log.info(s"Pressing $update") - FrontPressNotification.sendWithoutSubject(akkaAsync)(update.path) + FrontPressNotification.sendWithoutSubject(pekkoAsync)(update.path) } }) } diff --git a/admin/app/model/AdminLifecycle.scala b/admin/app/model/AdminLifecycle.scala index 877f92d0335..d6b815932c4 100644 --- a/admin/app/model/AdminLifecycle.scala +++ b/admin/app/model/AdminLifecycle.scala @@ -17,7 +17,7 @@ import scala.concurrent.{ExecutionContext, Future} class AdminLifecycle( appLifecycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, emailService: EmailService, fastlyCloudwatchLoadJob: FastlyCloudwatchLoadJob, r2PagePressJob: R2PagePressJob, @@ -68,17 +68,18 @@ class AdminLifecycle( } jobs.scheduleEveryNMinutes("FrontPressJobHighFrequency", adminPressJobHighPushRateInMinutes) { - if (FrontPressJobSwitch.isSwitchedOn) RefreshFrontsJob.runFrequency(akkaAsync)(HighFrequency) + if (FrontPressJobSwitch.isSwitchedOn) RefreshFrontsJob.runFrequency(pekkoAsync)(HighFrequency) Future.successful(()) } jobs.scheduleEveryNMinutes("FrontPressJobStandardFrequency", adminPressJobStandardPushRateInMinutes) { - if (FrontPressJobSwitchStandardFrequency.isSwitchedOn) RefreshFrontsJob.runFrequency(akkaAsync)(StandardFrequency) + if (FrontPressJobSwitchStandardFrequency.isSwitchedOn) + RefreshFrontsJob.runFrequency(pekkoAsync)(StandardFrequency) Future.successful(()) } jobs.scheduleEveryNMinutes("FrontPressJobLowFrequency", adminPressJobLowPushRateInMinutes) { - if (FrontPressJobSwitch.isSwitchedOn) RefreshFrontsJob.runFrequency(akkaAsync)(LowFrequency) + if (FrontPressJobSwitch.isSwitchedOn) RefreshFrontsJob.runFrequency(pekkoAsync)(LowFrequency) Future.successful(()) } //every 2, 17, 32, 47 minutes past the hour, on the 9th second past the minute (e.g 13:02:09, 13:17:09) @@ -122,7 +123,7 @@ class AdminLifecycle( descheduleJobs() scheduleJobs() - akkaAsync.after1s { + pekkoAsync.after1s { rebuildIndexJob.run() AssetMetricsCache.run() LoadBalancer.refresh() diff --git a/admin/app/services/EmailService.scala b/admin/app/services/EmailService.scala index dab31c0f8c9..bf086e15829 100644 --- a/admin/app/services/EmailService.scala +++ b/admin/app/services/EmailService.scala @@ -5,7 +5,7 @@ import java.util.concurrent.TimeoutException import com.amazonaws.handlers.AsyncHandler import com.amazonaws.services.simpleemail._ import com.amazonaws.services.simpleemail.model.{Destination => EmailDestination, _} -import common.{AkkaAsync, GuLogging} +import common.{PekkoAsync, GuLogging} import conf.Configuration.aws.mandatoryCredentials import scala.jdk.CollectionConverters._ @@ -14,7 +14,7 @@ import scala.concurrent.{ExecutionContext, Future, Promise} import scala.util.control.NonFatal import scala.util.{Failure, Success} -class EmailService(akkaAsync: AkkaAsync) extends GuLogging { +class EmailService(pekkoAsync: PekkoAsync) extends GuLogging { private lazy val client: AmazonSimpleEmailServiceAsync = AmazonSimpleEmailServiceAsyncClient .asyncBuilder() @@ -22,7 +22,7 @@ class EmailService(akkaAsync: AkkaAsync) extends GuLogging { .withRegion(conf.Configuration.aws.region) .build() - val sendAsync = client.sendAsyncEmail(akkaAsync) _ + val sendAsync = client.sendAsyncEmail(pekkoAsync) _ def shutdown(): Unit = client.shutdown() @@ -75,10 +75,10 @@ class EmailService(akkaAsync: AkkaAsync) extends GuLogging { private implicit class RichEmailClient(client: AmazonSimpleEmailServiceAsync) { - def sendAsyncEmail(akkaAsync: AkkaAsync)(request: SendEmailRequest): Future[SendEmailResult] = { + def sendAsyncEmail(pekkoAsync: PekkoAsync)(request: SendEmailRequest): Future[SendEmailResult] = { val promise = Promise[SendEmailResult]() - akkaAsync.after(1.minute) { + pekkoAsync.after(1.minute) { promise.tryFailure(new TimeoutException(s"Timed out")) } diff --git a/admin/app/services/R2PagePressNotifier.scala b/admin/app/services/R2PagePressNotifier.scala index da500aa265c..dc90dfde344 100644 --- a/admin/app/services/R2PagePressNotifier.scala +++ b/admin/app/services/R2PagePressNotifier.scala @@ -1,6 +1,6 @@ package services -import common.{AkkaAsync, GuLogging} +import common.{PekkoAsync, GuLogging} import implicits.R2PressNotification.pressMessageFormatter import model.R2PressMessage import play.api.libs.json.Json @@ -9,9 +9,9 @@ import scala.concurrent.ExecutionContext object R2PagePressNotifier extends GuLogging { - def enqueue(akkaAsync: AkkaAsync)(message: R2PressMessage)(implicit executionContext: ExecutionContext): String = { + def enqueue(pekkoAsync: PekkoAsync)(message: R2PressMessage)(implicit executionContext: ExecutionContext): String = { try { - R2PressNotification.sendWithoutSubject(akkaAsync)(Json.toJson[R2PressMessage](message).toString()) + R2PressNotification.sendWithoutSubject(pekkoAsync)(Json.toJson[R2PressMessage](message).toString()) val msg = s"Queued for pressing: ${message.url}." log.info(msg) msg diff --git a/admin/app/services/R2PressedPageTakedownNotifier.scala b/admin/app/services/R2PressedPageTakedownNotifier.scala index f9719c2770c..3ee325c4c56 100644 --- a/admin/app/services/R2PressedPageTakedownNotifier.scala +++ b/admin/app/services/R2PressedPageTakedownNotifier.scala @@ -1,14 +1,14 @@ package services -import common.{AkkaAsync, GuLogging} +import common.{PekkoAsync, GuLogging} import scala.concurrent.ExecutionContext object R2PressedPageTakedownNotifier extends GuLogging { - def enqueue(akkaAsync: AkkaAsync)(path: String)(implicit executionContext: ExecutionContext): String = { + def enqueue(pekkoAsync: PekkoAsync)(path: String)(implicit executionContext: ExecutionContext): String = { try { - R2PressedPageTakedownNotification.sendWithoutSubject(akkaAsync)(path) + R2PressedPageTakedownNotification.sendWithoutSubject(pekkoAsync)(path) val msg = s"Queued for takedown: $path" log.info(msg) msg diff --git a/admin/conf/application.conf b/admin/conf/application.conf index 3e9ba578bb3..6246032ed4b 100644 --- a/admin/conf/application.conf +++ b/admin/conf/application.conf @@ -1,6 +1,7 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] + +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/applications/app/jobs/SitemapLifecycle.scala b/applications/app/jobs/SitemapLifecycle.scala index 3b8d7abf27f..d2e578b5475 100644 --- a/applications/app/jobs/SitemapLifecycle.scala +++ b/applications/app/jobs/SitemapLifecycle.scala @@ -7,8 +7,9 @@ import services.{NewsSiteMap, VideoSiteMap} import scala.concurrent.ExecutionContext -class SiteMapLifecycle(jobs: JobScheduler, akkaAsync: AkkaAsync, siteMapJob: SiteMapJob)(implicit ec: ExecutionContext) - extends LifecycleComponent { +class SiteMapLifecycle(jobs: JobScheduler, pekkoAsync: PekkoAsync, siteMapJob: SiteMapJob)(implicit + ec: ExecutionContext, +) extends LifecycleComponent { override def start(): Unit = { jobs.deschedule("SiteMap") @@ -16,7 +17,7 @@ class SiteMapLifecycle(jobs: JobScheduler, akkaAsync: AkkaAsync, siteMapJob: Sit siteMapJob.update() } - akkaAsync.after1s { + pekkoAsync.after1s { siteMapJob.update() } } diff --git a/applications/conf/application.conf b/applications/conf/application.conf index 6f68b8963e4..98fa8264d4c 100644 --- a/applications/conf/application.conf +++ b/applications/conf/application.conf @@ -1,6 +1,6 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/archive/conf/application.conf b/archive/conf/application.conf index 6822cab7743..a348dc98482 100644 --- a/archive/conf/application.conf +++ b/archive/conf/application.conf @@ -1,6 +1,6 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/article/app/jobs/MessageUsLifecycle.scala b/article/app/jobs/MessageUsLifecycle.scala index 1bade323c8b..12fdc0bd3a9 100644 --- a/article/app/jobs/MessageUsLifecycle.scala +++ b/article/app/jobs/MessageUsLifecycle.scala @@ -1,7 +1,7 @@ package jobs import app.LifecycleComponent -import common.{AkkaAsync, JobScheduler} +import common.{PekkoAsync, JobScheduler} import play.api.inject.ApplicationLifecycle import services.MessageUsService @@ -11,7 +11,7 @@ import scala.concurrent.{ExecutionContext, Future} class MessageUsLifecycle( appLifeCycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, messageUsService: MessageUsService, )(implicit ec: ExecutionContext, @@ -28,7 +28,7 @@ class MessageUsLifecycle( scheduleJobs() // refresh message us data when app starts - akkaAsync.after1s { + pekkoAsync.after1s { messageUsService.refreshMessageUsData() } } diff --git a/article/app/jobs/TopicLifecycle.scala b/article/app/jobs/TopicLifecycle.scala index e1eb2439006..c4cb745f66d 100644 --- a/article/app/jobs/TopicLifecycle.scala +++ b/article/app/jobs/TopicLifecycle.scala @@ -1,7 +1,7 @@ package jobs import app.LifecycleComponent -import common.{AkkaAsync, JobScheduler} +import common.{PekkoAsync, JobScheduler} import play.api.inject.ApplicationLifecycle import topics.TopicService @@ -11,7 +11,7 @@ import scala.concurrent.{ExecutionContext, Future} class TopicLifecycle( appLifeCycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, topicService: TopicService, )(implicit ec: ExecutionContext) extends LifecycleComponent { @@ -26,7 +26,7 @@ class TopicLifecycle( scheduleJobs() // refresh top mentions when app starts - akkaAsync.after1s { + pekkoAsync.after1s { topicService.refreshTopics() } } diff --git a/article/conf/application.conf b/article/conf/application.conf index 629899b0595..ce05bd97f53 100644 --- a/article/conf/application.conf +++ b/article/conf/application.conf @@ -1,6 +1,6 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/build.sbt b/build.sbt index 0d7558c6b4f..e91f3db4e55 100644 --- a/build.sbt +++ b/build.sbt @@ -72,6 +72,7 @@ val common = library("common") okhttp, pekkoActor, pekkoStream, + pekkoSlf4j, ) ++ jackson, TestAssets / mappings ~= filterAssets, ) diff --git a/commercial/app/CommercialLifecycle.scala b/commercial/app/CommercialLifecycle.scala index 046ad2eb82f..bf467bdf7c3 100644 --- a/commercial/app/CommercialLifecycle.scala +++ b/commercial/app/CommercialLifecycle.scala @@ -6,7 +6,7 @@ import commercial.model.merchandise.jobs.Industries import app.LifecycleComponent import commercial.model.feeds._ import common.LoggingField._ -import common.{AkkaAsync, JobScheduler, GuLogging} +import common.{PekkoAsync, JobScheduler, GuLogging} import metrics.MetricUploader import play.api.inject.ApplicationLifecycle @@ -20,7 +20,7 @@ object CommercialMetrics { class CommercialLifecycle( appLifecycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, feedsFetcher: FeedsFetcher, feedsParser: FeedsParser, industries: Industries, @@ -143,7 +143,7 @@ class CommercialLifecycle( case (job, i) => job.start(delayedStartSchedule(delayedStart = i * refreshJobDelay, refreshStep = jobRefreshStep)) } - akkaAsync.after1s { + pekkoAsync.after1s { industries.refresh().failed.foreach { case NonFatal(e) => log.warn(s"Failed to refresh job industries: ${e.getMessage}") diff --git a/commercial/app/model/merchandise/books/BookFinder.scala b/commercial/app/model/merchandise/books/BookFinder.scala index 95d4d7d9a06..f7d6c775f63 100644 --- a/commercial/app/model/merchandise/books/BookFinder.scala +++ b/commercial/app/model/merchandise/books/BookFinder.scala @@ -18,7 +18,7 @@ import scala.util.{Failure, Success} class BookFinder(pekkoActorSystem: PekkoActorSystem, magentoService: MagentoService) extends GuLogging { private implicit val bookActorExecutionContext: ExecutionContext = - pekkoActorSystem.dispatchers.lookup("akka.actor.book-lookup") + pekkoActorSystem.dispatchers.lookup("pekko.actor.book-lookup") private implicit val bookActorTimeout: Timeout = 0.2.seconds private implicit val magentoServiceImplicit = magentoService @@ -72,7 +72,7 @@ class MagentoService(pekkoActorSystem: PekkoActorSystem, wsClient: WSClient) ext } private implicit val bookLookupExecutionContext: ExecutionContext = - pekkoActorSystem.dispatchers.lookup("akka.actor.book-lookup") + pekkoActorSystem.dispatchers.lookup("pekko.actor.book-lookup") private final val circuitBreaker = new CircuitBreaker( scheduler = pekkoActorSystem.scheduler, diff --git a/commercial/conf/application.conf b/commercial/conf/application.conf index f4992ec81b6..4b48d354131 100644 --- a/commercial/conf/application.conf +++ b/commercial/conf/application.conf @@ -1,6 +1,6 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/common/app/app/FrontendApplicationLoader.scala b/common/app/app/FrontendApplicationLoader.scala index 359462e4f22..161b0c05a20 100644 --- a/common/app/app/FrontendApplicationLoader.scala +++ b/common/app/app/FrontendApplicationLoader.scala @@ -43,7 +43,7 @@ trait FrontendComponents }) lazy val jobScheduler = new JobScheduler(appContext) - lazy val akkaAsync = new AkkaAsync(environment, pekkoActorSystem) + lazy val pekkoAsync = new PekkoAsync(environment, pekkoActorSystem) lazy val appMetrics = ApplicationMetrics() lazy val guardianConf = new GuardianConfiguration lazy val mode = environment.mode diff --git a/common/app/commercial/targeting/TargetingLifecycle.scala b/common/app/commercial/targeting/TargetingLifecycle.scala index 6bfa38cf448..613db558e5e 100644 --- a/common/app/commercial/targeting/TargetingLifecycle.scala +++ b/common/app/commercial/targeting/TargetingLifecycle.scala @@ -1,12 +1,12 @@ package commercial.targeting import app.LifecycleComponent -import common.{JobScheduler, AkkaAsync} +import common.{JobScheduler, PekkoAsync} import play.api.inject.ApplicationLifecycle import scala.concurrent.duration._ import scala.concurrent.{Future, ExecutionContext} -class TargetingLifecycle(appLifecycle: ApplicationLifecycle, jobs: JobScheduler, akkaAsync: AkkaAsync)(implicit +class TargetingLifecycle(appLifecycle: ApplicationLifecycle, jobs: JobScheduler, pekkoAsync: PekkoAsync)(implicit executionContext: ExecutionContext, ) extends LifecycleComponent { @@ -22,7 +22,7 @@ class TargetingLifecycle(appLifecycle: ApplicationLifecycle, jobs: JobScheduler, CampaignAgent.refresh() } - akkaAsync.after1s { + pekkoAsync.after1s { CampaignAgent.refresh() } } diff --git a/common/app/common/Logback/KinesisAdapter.scala b/common/app/common/Logback/KinesisAdapter.scala index 5db5d06246f..08ace58ec89 100644 --- a/common/app/common/Logback/KinesisAdapter.scala +++ b/common/app/common/Logback/KinesisAdapter.scala @@ -17,7 +17,7 @@ import scala.annotation.nowarn // LogbackOperationsPool must be wired as a singleton class LogbackOperationsPool(val pekkoActorSystem: PekkoActorSystem) { - val logbackOperations: MessageDispatcher = pekkoActorSystem.dispatchers.lookup("akka.logback-operations") + val logbackOperations: MessageDispatcher = pekkoActorSystem.dispatchers.lookup("pekko.logback-operations") } // The KinesisAppender[ILoggingEvent] blocks logging operations on putMessage. This overrides the KinesisAppender api, executing putMessage in an diff --git a/common/app/common/akka.scala b/common/app/common/akka.scala index 54ff88dc501..61778afb408 100644 --- a/common/app/common/akka.scala +++ b/common/app/common/akka.scala @@ -6,7 +6,7 @@ import play.api.{Environment => PlayEnv, Mode} import scala.concurrent.ExecutionContext import org.apache.pekko.actor.{ActorSystem => PekkoActorSystem} -class AkkaAsync(env: PlayEnv, pekkoActorSystem: PekkoActorSystem) { +class PekkoAsync(env: PlayEnv, pekkoActorSystem: PekkoActorSystem) { implicit val ec: ExecutionContext = pekkoActorSystem.dispatcher // "apply" isn't expressive and doesn't explain what it does. diff --git a/common/app/common/dfp/DfpAgentLifecycle.scala b/common/app/common/dfp/DfpAgentLifecycle.scala index 0d624db9566..40de6413596 100644 --- a/common/app/common/dfp/DfpAgentLifecycle.scala +++ b/common/app/common/dfp/DfpAgentLifecycle.scala @@ -1,12 +1,12 @@ package common.dfp import app.LifecycleComponent -import common.{JobScheduler, AkkaAsync} +import common.{JobScheduler, PekkoAsync} import play.api.inject.ApplicationLifecycle import scala.concurrent.{ExecutionContext, Future} -class DfpAgentLifecycle(appLifeCycle: ApplicationLifecycle, jobs: JobScheduler, akkaAsync: AkkaAsync)(implicit +class DfpAgentLifecycle(appLifeCycle: ApplicationLifecycle, jobs: JobScheduler, pekkoAsync: PekkoAsync)(implicit ec: ExecutionContext, ) extends LifecycleComponent { @@ -25,15 +25,15 @@ class DfpAgentLifecycle(appLifeCycle: ApplicationLifecycle, jobs: JobScheduler, Future.successful(()) } - akkaAsync.after1s { + pekkoAsync.after1s { refreshDfpAgent() } } } -class FaciaDfpAgentLifecycle(appLifeCycle: ApplicationLifecycle, jobs: JobScheduler, akkaAsync: AkkaAsync)(implicit +class FaciaDfpAgentLifecycle(appLifeCycle: ApplicationLifecycle, jobs: JobScheduler, pekkoAsync: PekkoAsync)(implicit ec: ExecutionContext, -) extends DfpAgentLifecycle(appLifeCycle, jobs, akkaAsync) { +) extends DfpAgentLifecycle(appLifeCycle, jobs, pekkoAsync) { override def refreshDfpAgent(): Unit = { DfpAgent.refresh() diff --git a/common/app/concurrent/BlockingOperations.scala b/common/app/concurrent/BlockingOperations.scala index a3582ba24c9..0be045cd144 100644 --- a/common/app/concurrent/BlockingOperations.scala +++ b/common/app/concurrent/BlockingOperations.scala @@ -6,7 +6,7 @@ import org.apache.pekko.dispatch.MessageDispatcher import scala.concurrent.Future class BlockingOperations(pekkoActorSystem: PekkoActorSystem) { - private val blockingOperations: MessageDispatcher = pekkoActorSystem.dispatchers.lookup("akka.blocking-operations") + private val blockingOperations: MessageDispatcher = pekkoActorSystem.dispatchers.lookup("pekko.blocking-operations") def executeBlocking[T](block: => T): Future[T] = { Future(block)(blockingOperations) diff --git a/common/app/conf/HealthCheck.scala b/common/app/conf/HealthCheck.scala index 07b69fb3dac..7604b05b991 100644 --- a/common/app/conf/HealthCheck.scala +++ b/common/app/conf/HealthCheck.scala @@ -208,7 +208,7 @@ abstract case class AnyGoodCachedHealthCheck(healthChecks: SingleHealthCheck*)(i class CachedHealthCheckLifeCycle( healthCheckController: CachedHealthCheck, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, )(implicit executionContext: ExecutionContext) extends LifecycleComponent { @@ -222,7 +222,7 @@ class CachedHealthCheckLifeCycle( } } - akkaAsync.after1s { + pekkoAsync.after1s { healthCheckController.runChecks() } } diff --git a/common/app/conf/switches/SwitchboardLifecycle.scala b/common/app/conf/switches/SwitchboardLifecycle.scala index ad5e81454e6..b3345b5469e 100644 --- a/common/app/conf/switches/SwitchboardLifecycle.scala +++ b/common/app/conf/switches/SwitchboardLifecycle.scala @@ -7,7 +7,7 @@ import play.api.inject.ApplicationLifecycle import scala.concurrent.duration._ import scala.concurrent.{Future, ExecutionContext} -class SwitchboardLifecycle(appLifecycle: ApplicationLifecycle, jobs: JobScheduler, akkaAsync: AkkaAsync)(implicit +class SwitchboardLifecycle(appLifecycle: ApplicationLifecycle, jobs: JobScheduler, pekkoAsync: PekkoAsync)(implicit ec: ExecutionContext, ) extends LifecycleComponent with GuLogging { @@ -20,7 +20,7 @@ class SwitchboardLifecycle(appLifecycle: ApplicationLifecycle, jobs: JobSchedule override def start(): Unit = { - Switches.all.foreach(_.failInitializationAfter(2.minutes)(akkaAsync)) + Switches.all.foreach(_.failInitializationAfter(2.minutes)(pekkoAsync)) jobs.deschedule("SwitchBoardRefreshJob") //run every minute, 47 seconds after the minute @@ -28,7 +28,7 @@ class SwitchboardLifecycle(appLifecycle: ApplicationLifecycle, jobs: JobSchedule refresh() } - akkaAsync.after1s { + pekkoAsync.after1s { refresh() } } diff --git a/common/app/conf/switches/Switches.scala b/common/app/conf/switches/Switches.scala index dcb7aaab3a3..cca65c7dc1e 100644 --- a/common/app/conf/switches/Switches.scala +++ b/common/app/conf/switches/Switches.scala @@ -51,8 +51,8 @@ trait Initializable[T] extends GuLogging { def initialize(t: T): Unit = initialized.trySuccess(t) def onInitialized: Future[T] = initialized.future - def failInitializationAfter(initializationTimeout: FiniteDuration)(akkaAsync: AkkaAsync): Unit = { - akkaAsync.after(initializationTimeout) { + def failInitializationAfter(initializationTimeout: FiniteDuration)(pekkoAsync: PekkoAsync): Unit = { + pekkoAsync.after(initializationTimeout) { initialized.tryFailure { new TimeoutException(s"Initialization timed out after $initializationTimeout") } diff --git a/common/app/contentapi/SectionsLookUpLifecycle.scala b/common/app/contentapi/SectionsLookUpLifecycle.scala index b469c42a439..2b06babe731 100644 --- a/common/app/contentapi/SectionsLookUpLifecycle.scala +++ b/common/app/contentapi/SectionsLookUpLifecycle.scala @@ -9,7 +9,7 @@ import scala.concurrent.{Future, ExecutionContext} class SectionsLookUpLifecycle( appLifecycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, sectionsLookUp: SectionsLookUp, )(implicit ec: ExecutionContext) extends LifecycleComponent @@ -35,7 +35,7 @@ class SectionsLookUpLifecycle( descheduleJobs() scheduleJobs() - akkaAsync.after1s { + pekkoAsync.after1s { sectionsLookUp.refresh() } } diff --git a/common/app/http/Filters.scala b/common/app/http/Filters.scala index 3b9bb6f72f7..cfc43c80e3f 100644 --- a/common/app/http/Filters.scala +++ b/common/app/http/Filters.scala @@ -144,6 +144,7 @@ object Filters { } +//Note: still using akka (instead of pekko) materializer from Play as both filters extend Play's Filter, so the types need to match class CommonFilters(frontendBuildInfo: FrontendBuildInfo)(implicit mat: Materializer, applicationContext: ApplicationContext, @@ -163,6 +164,5 @@ class PreloadFilters(implicit class CommonGzipFilter @Inject() (implicit mat: Materializer, ) extends HttpFilters { - val filters = Seq(new Gzipper) } diff --git a/common/app/services/ConfigAgentTrait.scala b/common/app/services/ConfigAgentTrait.scala index 26d8cf02c61..354481f179b 100644 --- a/common/app/services/ConfigAgentTrait.scala +++ b/common/app/services/ConfigAgentTrait.scala @@ -139,7 +139,7 @@ object ConfigAgent extends GuLogging { } -class ConfigAgentLifecycle(appLifecycle: ApplicationLifecycle, jobs: JobScheduler, akkaAsync: AkkaAsync)(implicit +class ConfigAgentLifecycle(appLifecycle: ApplicationLifecycle, jobs: JobScheduler, pekkoAsync: PekkoAsync)(implicit ec: ExecutionContext, ) extends LifecycleComponent { @@ -155,7 +155,7 @@ class ConfigAgentLifecycle(appLifecycle: ApplicationLifecycle, jobs: JobSchedule ConfigAgent.refresh } - akkaAsync.after1s { + pekkoAsync.after1s { ConfigAgent.refresh } } diff --git a/common/app/services/Notification.scala b/common/app/services/Notification.scala index d0a3a4a95a9..07efa73bb76 100644 --- a/common/app/services/Notification.scala +++ b/common/app/services/Notification.scala @@ -2,7 +2,7 @@ package services import com.amazonaws.services.sns.{AmazonSNSAsync, AmazonSNSAsyncClient} import com.amazonaws.services.sns.model.PublishRequest -import common.{AkkaAsync, GuLogging} +import common.{PekkoAsync, GuLogging} import conf.Configuration import awswrappers.sns._ @@ -22,28 +22,28 @@ trait Notification extends GuLogging { } def send( - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, )(subject: String, message: String)(implicit executionContext: ExecutionContext): Unit = { val request = new PublishRequest() .withTopicArn(topic) .withSubject(subject) .withMessage(message) - sendAsync(akkaAsync)(request) + sendAsync(pekkoAsync)(request) } - def sendWithoutSubject(akkaAsync: AkkaAsync)(message: String)(implicit executionContext: ExecutionContext): Unit = { + def sendWithoutSubject(pekkoAsync: PekkoAsync)(message: String)(implicit executionContext: ExecutionContext): Unit = { val request = new PublishRequest() .withTopicArn(topic) .withMessage(message) - sendAsync(akkaAsync)(request) + sendAsync(pekkoAsync)(request) } private def sendAsync( - akkaSync: AkkaAsync, + pekkoAsync: PekkoAsync, )(request: PublishRequest)(implicit executionContext: ExecutionContext): Unit = - akkaSync.after1s { + pekkoAsync.after1s { sns match { case Some(client) => log.info(s"Issuing SNS notification: ${request.getSubject}:${request.getMessage}") @@ -64,7 +64,7 @@ object SwitchNotification extends Notification { lazy val topic: String = Configuration.aws.notificationSns def onSwitchChanges( - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, )(requester: String, stage: String, changes: Seq[String])(implicit executionContext: ExecutionContext): Unit = { val subject = s"${stage.toUpperCase}: Switch changes by $requester" val message = @@ -75,7 +75,7 @@ object SwitchNotification extends Notification { | """.stripMargin - send(akkaAsync)(subject, message) + send(pekkoAsync)(subject, message) } } diff --git a/common/app/services/ophan/SurgingContentAgent.scala b/common/app/services/ophan/SurgingContentAgent.scala index 30cb00da105..ea6e79ba2a1 100644 --- a/common/app/services/ophan/SurgingContentAgent.scala +++ b/common/app/services/ophan/SurgingContentAgent.scala @@ -47,7 +47,7 @@ object SurgeUtils { class SurgingContentAgentLifecycle( appLifecycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, ophanApi: OphanApi, )(implicit ec: ExecutionContext) extends LifecycleComponent { @@ -66,7 +66,7 @@ class SurgingContentAgentLifecycle( SurgingContentAgent.update(ophanApi, ec) } - akkaAsync.after1s { + pekkoAsync.after1s { SurgingContentAgent.update(ophanApi, ec) } } diff --git a/common/conf/application.conf b/common/conf/application.conf index 62f847c7d26..87fd7cd714c 100644 --- a/common/conf/application.conf +++ b/common/conf/application.conf @@ -1,4 +1,4 @@ -akka { +pekko { logback-operations { executor = "thread-pool-executor" throughput = 10 diff --git a/common/conf/test.conf b/common/conf/test.conf index 93fadcd02fc..50e3e7b5aa6 100644 --- a/common/conf/test.conf +++ b/common/conf/test.conf @@ -1,4 +1,4 @@ -akka { +pekko { blocking-operations { executor = "thread-pool-executor" throughput = 10 diff --git a/dev-build/conf/dev-build.application.conf b/dev-build/conf/dev-build.application.conf index 581afd80b5d..8fe016c1a70 100644 --- a/dev-build/conf/dev-build.application.conf +++ b/dev-build/conf/dev-build.application.conf @@ -1,5 +1,5 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/discussion/conf/application.conf b/discussion/conf/application.conf index 81099f87ba2..4b345434efc 100644 --- a/discussion/conf/application.conf +++ b/discussion/conf/application.conf @@ -1,6 +1,6 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/facia-press/conf/application.conf b/facia-press/conf/application.conf index 13d1f8b93cc..905a4a32fbd 100644 --- a/facia-press/conf/application.conf +++ b/facia-press/conf/application.conf @@ -1,6 +1,6 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/facia/app/feed/DeeplyReadLifecycle.scala b/facia/app/feed/DeeplyReadLifecycle.scala index 39b70cf7b63..47700e92674 100644 --- a/facia/app/feed/DeeplyReadLifecycle.scala +++ b/facia/app/feed/DeeplyReadLifecycle.scala @@ -2,7 +2,7 @@ package feed import agents.DeeplyReadAgent import app.LifecycleComponent -import common.{AkkaAsync, JobScheduler} +import common.{PekkoAsync, JobScheduler} import play.api.inject.ApplicationLifecycle import java.util.concurrent.Executors @@ -11,7 +11,7 @@ import scala.concurrent.{ExecutionContext, Future} class DeeplyReadLifecycle( appLifecycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, deeplyReadAgent: DeeplyReadAgent, ) extends LifecycleComponent { @@ -35,7 +35,7 @@ class DeeplyReadLifecycle( deeplyReadAgent.refresh() } - akkaAsync.after1s { + pekkoAsync.after1s { deeplyReadAgent.refresh() } } diff --git a/facia/app/feed/MostViewedLifecycle.scala b/facia/app/feed/MostViewedLifecycle.scala index 6177dbbd496..985ffb94684 100644 --- a/facia/app/feed/MostViewedLifecycle.scala +++ b/facia/app/feed/MostViewedLifecycle.scala @@ -4,7 +4,7 @@ import agents.MostViewedAgent import java.util.concurrent.Executors import app.LifecycleComponent -import common.{AkkaAsync, JobScheduler} +import common.{PekkoAsync, JobScheduler} import play.api.inject.ApplicationLifecycle import scala.concurrent.{ExecutionContext, Future} @@ -12,7 +12,7 @@ import scala.concurrent.{ExecutionContext, Future} class MostViewedLifecycle( appLifecycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, mostViewedAgent: MostViewedAgent, ) extends LifecycleComponent { @@ -36,7 +36,7 @@ class MostViewedLifecycle( mostViewedAgent.refresh() } - akkaAsync.after1s { + pekkoAsync.after1s { mostViewedAgent.refresh() } } diff --git a/facia/conf/application.conf b/facia/conf/application.conf index e26bccd7471..ec8fbd10aee 100644 --- a/facia/conf/application.conf +++ b/facia/conf/application.conf @@ -6,8 +6,8 @@ "assets.cache./public/security.txt"="public, max-age=900" "assets.cache./public/security.txt.asc"="public, max-age=900" -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/identity/app/conf/IdentityLifecycle.scala b/identity/app/conf/IdentityLifecycle.scala index 242b835b85e..58b16528637 100644 --- a/identity/app/conf/IdentityLifecycle.scala +++ b/identity/app/conf/IdentityLifecycle.scala @@ -1,7 +1,7 @@ package conf import app.LifecycleComponent -import common.{JobScheduler, AkkaAsync} +import common.{JobScheduler, PekkoAsync} import jobs.TorExitNodeList import model.PhoneNumbers import play.api.inject.ApplicationLifecycle @@ -10,7 +10,7 @@ import scala.concurrent.{Future, ExecutionContext} class IdentityLifecycle( appLifecycle: ApplicationLifecycle, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, jobs: JobScheduler, )(implicit ec: ExecutionContext) extends LifecycleComponent { @@ -35,7 +35,7 @@ class IdentityLifecycle( descheduleJobs() scheduleJobs() - akkaAsync.after1s { + pekkoAsync.after1s { TorExitNodeList.run() PhoneNumbers } diff --git a/identity/conf/application.conf b/identity/conf/application.conf index 8d925a506b1..8277555019d 100644 --- a/identity/conf/application.conf +++ b/identity/conf/application.conf @@ -1,5 +1,5 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/onward/app/feed/OnwardJourneyLifecycle.scala b/onward/app/feed/OnwardJourneyLifecycle.scala index 593adf1bef2..2aa1903d3d3 100644 --- a/onward/app/feed/OnwardJourneyLifecycle.scala +++ b/onward/app/feed/OnwardJourneyLifecycle.scala @@ -3,14 +3,14 @@ package feed import agents.DeeplyReadAgent import java.util.concurrent.Executors import app.LifecycleComponent -import common.{AkkaAsync, JobScheduler} +import common.{PekkoAsync, JobScheduler} import play.api.inject.ApplicationLifecycle import scala.concurrent.{ExecutionContext, Future} class OnwardJourneyLifecycle( appLifecycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, mostReadAgent: MostReadAgent, geoMostPopularAgent: GeoMostPopularAgent, dayMostPopularAgent: DayMostPopularAgent, @@ -56,7 +56,7 @@ class OnwardJourneyLifecycle( dayMostPopularAgent.refresh() } - akkaAsync.after1s { + pekkoAsync.after1s { mostPopularAgent.refresh() deeplyReadAgent.refresh() geoMostPopularAgent.refresh() diff --git a/onward/conf/application.conf b/onward/conf/application.conf index e8d525073ec..dcb97acd6cd 100644 --- a/onward/conf/application.conf +++ b/onward/conf/application.conf @@ -1,6 +1,6 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/preview/conf/application.conf b/preview/conf/application.conf index 7fd169772ee..2e4f1637c99 100644 --- a/preview/conf/application.conf +++ b/preview/conf/application.conf @@ -1,5 +1,5 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 6cd532273ce..8f947793fc0 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -75,6 +75,7 @@ object Dependencies { val pekkoVersion = "1.0.1" val pekkoActor = "org.apache.pekko" %% "pekko-actor" % pekkoVersion val pekkoStream = "org.apache.pekko" %% "pekko-stream" % pekkoVersion + val pekkoSlf4j = "org.apache.pekko" %% "pekko-slf4j" % pekkoVersion val logback2 = "net.logstash.logback" % "logstash-logback-encoder" % "4.6" // logback2 to prevent "error: reference to logback is ambiguous;" diff --git a/rss/conf/application.conf b/rss/conf/application.conf index 3480c406815..fe1bd5216e8 100644 --- a/rss/conf/application.conf +++ b/rss/conf/application.conf @@ -1,6 +1,6 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = { diff --git a/sport/app/cricket/conf/context.scala b/sport/app/cricket/conf/context.scala index 1cb9bf9a9c6..625daed4206 100644 --- a/sport/app/cricket/conf/context.scala +++ b/sport/app/cricket/conf/context.scala @@ -1,7 +1,7 @@ package cricket.conf import app.LifecycleComponent -import common.{AkkaAsync, JobScheduler} +import common.{PekkoAsync, JobScheduler} import jobs.CricketStatsJob import java.time.LocalDate @@ -13,7 +13,7 @@ import scala.concurrent.{ExecutionContext, Future} class CricketLifecycle( appLifeCycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, cricketStatsJob: CricketStatsJob, )(implicit ec: ExecutionContext) extends LifecycleComponent { @@ -43,7 +43,7 @@ class CricketLifecycle( scheduleJobs() // ensure that we populate the cricket stats cache immediately - akkaAsync.after1s { + pekkoAsync.after1s { cricketStatsJob.run(fromDate = LocalDate.now.minusMonths(2), matchesToFetch = 10) } } diff --git a/sport/app/football/conf/context.scala b/sport/app/football/conf/context.scala index 996577c2dd5..f8f75ae2070 100644 --- a/sport/app/football/conf/context.scala +++ b/sport/app/football/conf/context.scala @@ -15,7 +15,7 @@ import java.time.Clock class FootballLifecycle( appLifeCycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, competitionsService: CompetitionsService, contentApiClient: ContentApiClient, )(implicit ec: ExecutionContext) @@ -79,7 +79,7 @@ class FootballLifecycle( descheduleJobs() scheduleJobs() - akkaAsync.after1s { + pekkoAsync.after1s { val competitionUpdate = competitionsService.refreshCompetitionData() competitionUpdate.foreach { _ => competitionsService.competitionIds.foreach(id => competitionsService.refreshCompetitionAgent(id, defaultClock)) diff --git a/sport/app/rugby/conf/RugbyLifecycle.scala b/sport/app/rugby/conf/RugbyLifecycle.scala index ac2c8342d0d..f73e63f6e3e 100644 --- a/sport/app/rugby/conf/RugbyLifecycle.scala +++ b/sport/app/rugby/conf/RugbyLifecycle.scala @@ -1,7 +1,7 @@ package rugby.conf import app.LifecycleComponent -import common.{AkkaAsync, JobScheduler} +import common.{PekkoAsync, JobScheduler} import play.api.inject.ApplicationLifecycle import rugby.feed.CapiFeed import rugby.jobs.RugbyStatsJob @@ -12,7 +12,7 @@ import scala.concurrent.duration._ class RugbyLifecycle( appLifeCycle: ApplicationLifecycle, jobs: JobScheduler, - akkaAsync: AkkaAsync, + pekkoAsync: PekkoAsync, rugbyStatsJob: RugbyStatsJob, capiFeed: CapiFeed, )(implicit ec: ExecutionContext) @@ -34,12 +34,12 @@ class RugbyLifecycle( rugbyStatsJob.sendMatchArticles(refreshedNavContent) } - akkaAsync.after1s { + pekkoAsync.after1s { rugbyStatsJob.fetchFixturesAndResults() } //delay to allow previous jobs to complete - akkaAsync.after(initializationTimeout) { + pekkoAsync.after(initializationTimeout) { val refreshedNavContent = capiFeed.getMatchArticles(rugbyStatsJob.getAllResults()) rugbyStatsJob.sendMatchArticles(refreshedNavContent) } diff --git a/sport/conf/application.conf b/sport/conf/application.conf index e01aef34ef5..3d34f2449fe 100644 --- a/sport/conf/application.conf +++ b/sport/conf/application.conf @@ -1,6 +1,6 @@ -akka { - loggers = ["akka.event.Logging$DefaultLogger", "akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.Logging$DefaultLogger", "org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = WARNING actor { default-dispatcher = {