Move prevent_inert_check to During facet, where it is more generally useful
This commit is contained in:
parent
fb6070d1cd
commit
74ca267cef
|
@ -111,7 +111,13 @@ where
|
|||
Fa1: 'static + Send + FnMut(&mut E, &mut Activation, M) -> ActorResult
|
||||
{
|
||||
self.on_asserted(Box::new(move |state, t, a| {
|
||||
let facet_id = t.facet(|t| assertion_handler(state, t, a))?;
|
||||
let facet_id = t.facet(|t| {
|
||||
// Prevent inertness check because we have a bounded lifetime anyway. This
|
||||
// allows e.g. facets containing Supervisors to Just Work (they go momentarily
|
||||
// inert when their supervisee exits).
|
||||
let _ = t.prevent_inert_check();
|
||||
assertion_handler(state, t, a)
|
||||
})?;
|
||||
Ok(Some(Box::new(move |_state, t| {
|
||||
t.stop_facet(facet_id, None);
|
||||
Ok(())
|
||||
|
|
|
@ -130,15 +130,6 @@ impl<Boot: 'static + Send + FnMut(&mut Activation) -> ActorResult> Supervisor<Bo
|
|||
restarts: VecDeque::new(),
|
||||
supervisee: Supervisee::NotRunning,
|
||||
};
|
||||
|
||||
// In cases where we are the only Entity in our Facet, and our
|
||||
// supervisee terminates, we will often be "inert" until we
|
||||
// can restart it. So we prevent_inert_check to signal to the
|
||||
// system that there's something going on for that moment of
|
||||
// time between the supervisee terminating and our responding
|
||||
// to it.
|
||||
let _ = t.prevent_inert_check();
|
||||
|
||||
supervisor.ensure_started(t).unwrap();
|
||||
self_ref.become_entity(supervisor);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue