Skip to content

Commit

Permalink
Merge pull request #540 from jackgene/kotlin-flow-scenario-11
Browse files Browse the repository at this point in the history
Kotlin Flow scenario 11
  • Loading branch information
jamesward authored Dec 23, 2024
2 parents c86b227 + e9150c4 commit dab2975
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ docker run -it -p8080:8080 ghcr.io/jamesward/easyracer --debug
| [Scala 3 + Gears](scala-gears) | 11/11 ![tests](https://github.com/jamesward/easyracer/actions/workflows/scala-gears.yaml/badge.svg) | [Jack Leow](https://github.com/jackgene) | |
| [Scala 3 + Akka Streams](scala-akkastreams) | 11/11 ![tests](https://github.com/jamesward/easyracer/actions/workflows/scala-akkastreams.yaml/badge.svg) | [Jack Leow](https://github.com/jackgene) | |
| [Kotlin + Coroutines](kotlin-coroutines) | 11/11 ![tests](https://github.com/jamesward/easyracer/actions/workflows/kotlin-coroutines.yaml/badge.svg) | [Jack Leow](https://github.com/jackgene) | |
| [Kotlin + Flow](kotlin-flow) | 10/11 ![tests](https://github.com/jamesward/easyracer/actions/workflows/kotlin-flow.yaml/badge.svg) | [Jack Leow](https://github.com/jackgene) | |
| [Kotlin + Flow](kotlin-flow) | 11/11 ![tests](https://github.com/jamesward/easyracer/actions/workflows/kotlin-flow.yaml/badge.svg) | [Jack Leow](https://github.com/jackgene) | |
| [Kotlin + Splitties](kotlin-splitties) | 11/11 ![tests](https://github.com/jamesward/easyracer/actions/workflows/kotlin-splitties.yaml/badge.svg) | [James Ward](https://github.com/jamesward) | |
| [Kotlin + Arrow](kotlin-arrow) | 11/11 ![tests](https://github.com/jamesward/easyracer/actions/workflows/kotlin-arrow.yaml/badge.svg) | [James Ward](https://github.com/jamesward) | |
| [Java + Loom](java-loom) | 10/11 ![tests](https://github.com/jamesward/easyracer/actions/workflows/java-loom.yaml/badge.svg) | [James Ward](https://github.com/jamesward) | |
Expand Down
7 changes: 7 additions & 0 deletions kotlin-flow/src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ suspend fun scenario10(url: (Int) -> String): String {
return merge(blocker, reporter()).filterNotNull().first()
}

suspend fun scenario11(url: (Int) -> String): String {
val req = client.getAsFlow(url(11)).catch {}.map { it.bodyAsText() }

return merge(merge(req, req), req).first()
}

val scenarios = listOf(
::scenario1,
::scenario2,
Expand All @@ -145,6 +151,7 @@ val scenarios = listOf(
::scenario8,
::scenario9,
::scenario10,
::scenario11,
)

suspend fun results(url: (Int) -> String) = scenarios.map {
Expand Down

0 comments on commit dab2975

Please sign in to comment.