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

Skip to content

Conversation

@kyri-petrou
Copy link
Contributor

/fixes #9494

It seems that in in ZIO 2.0.x we were relying on calling onEnd only by adding an observer when we forked the fiber. Some time in the development of ZIO 2.1 the onEnd method was also being called within the FiberRuntime.evaluateEffect, causing it to be called twice.

This PR delegates the responsibility of calling onEnd entirely to the FiberRuntime instead of relying on externally adding an observer.

@kyri-petrou kyri-petrou requested a review from jdegoes February 3, 2025 07:57
if (supervisor ne Supervisor.none) supervisor.onSuspend(self)(Unsafe)
if (supervisor ne Supervisor.none) {
if (finalExit ne null) supervisor.onEnd(finalExit, self)(Unsafe)
supervisor.onSuspend(self)(Unsafe)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there should probably be an else statement here, but I'm worried this might cause issues in cases we're expecting the onSuspend method to be called regardless whether we've suspended or exited so I decided to leave it as it was (with onEnd being called first as that was the behaviour previously)

@jdegoes jdegoes merged commit 828147c into zio:series/2.x Feb 4, 2025
18 checks passed
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.

After update to ZIO 2.1 on_start of Supervisor works strange

2 participants