Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@luis3m
Copy link
Contributor

@luis3m luis3m commented Aug 31, 2020

Closes #4118
Closes #4119

@luis3m luis3m requested a review from iravid as a code owner August 31, 2020 17:11
_ <- halt.fail("Fail")
result <- ZStream(1)
.haltWhen(halt)
.interruptWhen(halt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦

@iravid
Copy link
Member

iravid commented Aug 31, 2020

This appears to break on Scala.js. Could you look into that?

@luis3m
Copy link
Contributor Author

luis3m commented Sep 1, 2020

@iravid done, ZStream(1).forever.interruptWhen(halt.await) was failing to fail on Scala.js apparently because of the initial overhead of .disconnect.

)
as <- self.process
done <- Ref.makeManaged(false)
asPull = p.await.asSomeError *> done.set(true) *> Pull.end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I compared with my suggestion here and that one got #4119 right, but would also experience #4118

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@svroonland are you sure? it checks on every pull whether the promise is done and there's a unit test for that case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luis3m Ah yes on closer look, you are right. So they would appear to be equivalent then..? (just for learning purposes, you can disregard this comment thread when it comes to this PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@svroonland no worries. Yes, they are.

@iravid iravid changed the title Fix ZStream#interruptWhen promise check Add a promise poll to ZStream#interruptWhen Sep 22, 2020
@iravid iravid merged commit b79b1db into zio:master Sep 22, 2020
@iravid
Copy link
Member

iravid commented Sep 22, 2020

Thank you @luis3m!

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

Successfully merging this pull request may close these issues.

ZStream.interruptWhen could do an initial poll on the promise ZStream.interruptWhen sometimes does not emit the failure from the promise

3 participants