Created
May 10, 2020 20:06
-
-
Save jchapuis/c146ccc657e33685cdad5e38e64aa5dc 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