Closed slawlor closed 9 months ago
Patch coverage: 94.70%
and project coverage change: +0.29%
:tada:
Comparison is base (
bb33d4f
) 78.91% compared to head (8a3ed35
) 79.20%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Motivation
link
ing an actor to another actor, inractor
, invokes the parent-child relationship and makes the parent the supervisor of the child. This means if the parent dies, before the child can process a supervision event (in say a doubly-linked scenario), the child will be terminated as part of the parent's exit flow (and not just terminated, but killed halting any async work in any flow).This is non-ideal for looser ownership scenarios.
This PR introduces the notion of
monitor
ing (along withunmonitor
andclear_monitors
) which allows a non-parent relationship to supervision. This means an actor can monitor another actor without being in the direct lifecycle path yet still receive supervision events.NOTE: In order to not require the state to implement
Clone
, we instead add a "slimmed out" supervision event for monitors, such that they (a) won't receive the actor's state upon a termination event, if available at all, and (b) won't receive the actual exception with potential extra information, rather a serialized string version. This helps require that the underlyingActor::State
be as limited in trait implementations as possible (justSend + 'static
)Tests added on new functionality