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 · 3 comments
Open

mapZIOParUnordered does not respect parallelism #8753

adrian-salajan opened this issue Apr 16, 2024 · 3 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

@jdegoes
Copy link
Member

jdegoes commented May 8, 2024

/bounty $100

Copy link

algora-pbc bot commented May 8, 2024

💎 $100 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #8753 with your implementation plan
  2. Submit work: Create a pull request including /claim #8753 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @varshith257 May 20, 2024, 2:57:18 PM WIP

@varshith257
Copy link

varshith257 commented May 20, 2024

/attempt #8753

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

No branches or pull requests

3 participants