Created
May 10, 2020 20:18
-
-
Save jchapuis/5f52d3317b9e7d3db97a7ea86176871b to your computer and use it in GitHub Desktop.
Markdium-Orchestrating startup and shutdown in Scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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