Skip to content

Instantly share code, notes, and snippets.

@jchapuis
Created May 10, 2020 19:38
Show Gist options
  • Select an option

  • Save jchapuis/af58bf021a7fa7e3c234c21f16dfd54a to your computer and use it in GitHub Desktop.

Select an option

Save jchapuis/af58bf021a7fa7e3c234c21f16dfd54a to your computer and use it in GitHub Desktop.
Markdium-Orchestrating startup and shutdown in Scala
(for {
_ <- Task.fromFuture(stopTriggered)
results <- startResults
stopResults <- Observable
.fromIterable(results.startedServices.reverse)
.mapEval(stopService)
.foldLeftL(List.empty[Either[ServiceStopError, Service]])(
(stopResults, stopResult) => stopResults :+ stopResult
)
} yield {
stopResults
}): Task[List[Either[ServiceStopError, Service]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment