Skip to content

Commit

Permalink
Add SNS topic to facia press function
Browse files Browse the repository at this point in the history
  • Loading branch information
silvacb committed Oct 17, 2023
1 parent 6f8327d commit 1ec8a77
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Components.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class AppComponents(context: Context, val config: ApplicationConfiguration)
val collectionService = new CollectionService(frontsApi, containerService)
val faciaPressQueue = new FaciaPressQueue(config)
val faciaPressTopic = new FaciaPressTopic(config)
val faciaPress = new FaciaPress(faciaPressQueue, configAgent)
val faciaPress = new FaciaPress(faciaPressQueue, faciaPressTopic, configAgent)
val updateActions = new UpdateActions(faciaApiIO, frontsApi, config, configAgent, structuredLogger)
val updateManager = new UpdateManager(updateActions, configAgent, s3FrontsApi)
val cloudwatch = new CloudWatch(config, awsEndpoints)
Expand Down
18 changes: 17 additions & 1 deletion app/services/FaciaPress.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class FaciaPressTopic(val config: ApplicationConfiguration) {

}

class FaciaPress(val faciaPressQueue: FaciaPressQueue, val configAgent: ConfigAgent) extends Logging {
class FaciaPress(val faciaPressQueue: FaciaPressQueue, val faciaPressTopic: FaciaPressTopic, val configAgent: ConfigAgent) extends Logging {
def press(pressCommand: PressCommand): Future[List[SendMessageResult]] = {
configAgent.refreshAndReturn() flatMap { _ =>
val paths: Set[String] = for {
Expand All @@ -94,6 +94,14 @@ class FaciaPress(val faciaPressQueue: FaciaPressQueue, val configAgent: ConfigAg
case Success(_) =>
EnqueuePressSuccess.increment()
}
val fut2 = Future.traverse(paths)(path => faciaPressTopic.publish(PressJob(FrontPath(path), Live, forceConfigUpdate = pressCommand.forceConfigUpdate)))
fut2.onComplete {
case Failure(error) =>
EnqueuePressFailure.increment()
logger.error("Error manually pressing live collection through update from tool", error)
case Success(_) =>
EnqueuePressSuccess.increment()
}
fut
} else {
Future.successful(Set.empty)
Expand All @@ -110,6 +118,14 @@ class FaciaPress(val faciaPressQueue: FaciaPressQueue, val configAgent: ConfigAg
case Success(_) =>
EnqueuePressSuccess.increment()
}
val fut2 = Future.traverse(paths)(path => faciaPressTopic.publish(PressJob(FrontPath(path), Draft, forceConfigUpdate = pressCommand.forceConfigUpdate)))
fut2.onComplete {
case Failure(error) =>
EnqueuePressFailure.increment()
logger.error("Error manually pressing draft collection through update from tool", error)
case Success(_) =>
EnqueuePressSuccess.increment()
}
fut
} else Future.successful(Set.empty)

Expand Down

0 comments on commit 1ec8a77

Please sign in to comment.