We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I found really weird behavior in ZLayer with >+>
ZLayer
>+>
ZIO version: 1.0.0-R21-2
import zio._ import zio.console._ import zio.clock._ object LayerStuck extends zio.App { val env = ZLayer.fromEffect(ZIO.effect(1/0)) ++ ((Console.live ++ Clock.live) >+> ZLayer.fromManaged( ZManaged .makeEffect { //This can be anything that take time to initialize for me it was ActorSystem Thread.sleep(5000) println("open") }{_ => Thread.sleep(5000); println("closed")} )) def run(args: List[String]) = ZIO.unit.as(ExitCode.success) .provideCustomLayer(env) .catchAll(cause => putStrLn("error: " + cause).as(ExitCode.failure)) <* putStrLn("the end") }
for given code I'm getting output below and program never ends.
error: java.lang.ArithmeticException: / by zero the end open closed
if I change >+> to >>> program works as expected and exit with code 1
>>>
open closed error: java.lang.ArithmeticException: / by zero the end
one more observation is that if I changed putStrLn("the end") to putStrLn("the end").delay(10.seconds) program complete as expected.
putStrLn("the end")
putStrLn("the end").delay(10.seconds)
The text was updated successfully, but these errors were encountered:
I'm wondering if this could be related to #3940.
Sorry, something went wrong.
there is a chance they are related because it seems that with >+> init code is async ( not really sure if this is expected ).
error: java.lang.ArithmeticException: / by zero the end open //this should be on the top closed
but there is chance that this is different too. this delay putStrLn("the end").delay(10.seconds) which helps here doesn't help for snippet in #3940
Successfully merging a pull request may close this issue.
I found really weird behavior in
ZLayer
with>+>
ZIO version: 1.0.0-R21-2
for given code I'm getting output below and program never ends.
if I change
>+>
to>>>
program works as expected and exit with code 1one more observation is that if I changed
putStrLn("the end")
toputStrLn("the end").delay(10.seconds)
program complete as expected.The text was updated successfully, but these errors were encountered: