Skip to content

Commit

Permalink
add recover
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoworko committed Dec 17, 2024
1 parent fc79512 commit b5d9679
Showing 1 changed file with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,12 @@ class DeploymentService(
.map {
case process if process.isFragment => DBIO.successful(process)
case process =>
val prefetched =
prefetchedStates
.get(process.processingType)
.flatMap(_.get(process.name))
val prefetchedStatesForProcess = prefetchedStates.get(process.processingType).flatMap(_.get(process.name))
getProcessState(
process.toEntity,
actionsInProgress.getOrElse(process.processIdUnsafe, Set.empty),
None,
prefetched,
prefetchedStatesForProcess,
).map(state => process.copy(state = Some(state)))
}
.sequence[DB, ScenarioWithDetails]
Expand All @@ -490,17 +487,27 @@ class DeploymentService(
val deploymentManagersByProcessingTypes =
allProcessingTypes.flatMap(pt => dispatcher.deploymentManager(pt).map(dm => (pt, dm)))
val prefetchedStatesByProcessingTypes = Future
.sequence(
deploymentManagersByProcessingTypes.flatMap { case (processingType, manager) =>
.sequence {
deploymentManagersByProcessingTypes.map { case (processingType, manager) =>
manager match {
case dm: StateQueryForAllScenariosSupported =>
Some(dm.getProcessesStates().map(states => (processingType, states)))
dm
.getProcessesStates()
.map(states => Some((processingType, states)))
.recover { case NonFatal(e) =>
logger.warn(
s"Failed to get statuses of all scenarios in deployment manager for $processingType: ${e.getMessage}",
e
)
None
}
case _ =>
None
Future.successful(None)
}
}
)
.map(_.toMap)
}
.map(_.flatten.toMap)

prefetchedStatesByProcessingTypes
}

Expand Down

0 comments on commit b5d9679

Please sign in to comment.