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

Skip to content

Conversation

@quelgar
Copy link
Contributor

@quelgar quelgar commented Jun 11, 2025

See #9668 for rationale.

This adds Supervisor#addPatch that works the same as ++ except: if the supervisor to be added is already present, the current supervisor is returned unchanged. This is used to implement AddSupervisor patching, so that complex layer graphs never result in a supervisor being added more than once.

@kyri-petrou please take a look at your convenience.

Comment on lines 51 to 52
final def ++[B](that: Supervisor[B]): Supervisor[(A, B)] =
Supervisor.Zip(self, that)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think you need patchAdd - we should just change the behavior of ++.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, we can, but it that requires making the return type Supervisor[Any]. While nothing in ZIO seems to actually use the returned tuple, it's a public API so we can't change it now.

Copy link
Contributor

Choose a reason for hiding this comment

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

@quelgar this method is still being used in 2 places:

The second one I'm not sure we need to change it but the first one definitely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep changed the first one, thanks.

For the second, yeah it's not actually adding anything, it's just rebuilding based on the existing graph, so no need to change it 👍 .

Copy link
Contributor

@kyri-petrou kyri-petrou left a comment

Choose a reason for hiding this comment

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

LGTM, just a minor comment

Comment on lines 51 to 52
final def ++[B](that: Supervisor[B]): Supervisor[(A, B)] =
Supervisor.Zip(self, that)
Copy link
Contributor

Choose a reason for hiding this comment

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

@quelgar this method is still being used in 2 places:

The second one I'm not sure we need to change it but the first one definitely.

@quelgar quelgar force-pushed the change-supervisor-patch branch from b4b6937 to 0678ec6 Compare June 15, 2025 06:09
@kyri-petrou kyri-petrou merged commit 8462596 into zio:series/2.x Jun 15, 2025
19 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.

3 participants