-
Couldn't load subscription status.
- Fork 1.4k
Immediately Shift to ZIO Thread Pool In UnsafeRunAsync #4120
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
Conversation
|
I think we have to avoid this behavior on Scala.js, or else it becomes impossible to run anything asynchronously, right? At least, assuming we end up with Some callback code in JS has to be run synchronously: e.g. when you handle a mouse or keyboard event. |
|
Yes, I think that is a fairly straightforward change on Scala.js. The fact that all the test suites fail with this change on the JVM is somewhat concerning. |
|
The issue was that |
|
Just a thought: Why not use That will actually guarantee that the callback scheduled will execute as soon as the current call stack is completed. |
|
@tusharmath I think we need to do a subsequent PR where we look at all the options for how submitting an effect to the |
| context.runAsync(k) | ||
|
|
||
| fiberId => unsafeRun(context.interruptAs(fiberId)) | ||
| lazy val curZIO = if (Platform.isJS) zio else ZIO.yieldNow *> zio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't the situation of JavaScript here similar to that of Native?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the situation is on Native here. At this point we have no tests for Native and there is an ongoing effort to get those working with associated changes so my overall point of view is we address Native specific issues as part of that but could definitely flip this to only yield on the JVM.
Resolves #4117.