Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapZIOParUnordered does not respect parallelism #8753

Open
adrian-salajan opened this issue Apr 16, 2024 · 0 comments
Open

mapZIOParUnordered does not respect parallelism #8753

adrian-salajan opened this issue Apr 16, 2024 · 0 comments

Comments

@adrian-salajan
Copy link

adrian-salajan commented Apr 16, 2024

I am surprised of what this program using mapZIOParUnordered outputs

  override def run: ZIO[Any with ZIOAppArgs with Scope, Any, Any] = for {
    _ <- ZIO.debug("start")
    _ <- ZStream
      .iterate[Int](0)(n => n +1)
      .mapZIOParUnordered(2){ _ =>
        ZIO.debug("tick").delay(1.second)
      }.runDrain.zipParLeft(ZIO.debug("----").delay(2.seconds).forever)

  } yield ()

the number of ticks printed between the ----- is: 2, 7, 11, 15, 19, 23 ....
while if instead of mapZIOParUnordered(2) i use mapZioPar(2) ticks printed is: 2, 6, 6, 6, 6. Here i would expect it to be 4, 4, 4, 4 but at least it does not keep increasing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant