Created
May 10, 2020 19:38
-
-
Save jchapuis/af58bf021a7fa7e3c234c21f16dfd54a 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