You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scenario: my actor registers a schedule and I was under the impression that I should cancel the schedule when the actor is shutting down. Unfortunately, Actor::post_stop doesn't have a reference to ActorSystem so I cannot cancel the schedule there.
It's possible that schedules for terminated actors get cleaned up automatically but during experimentation I realised that Actor::sys_recv doesn't get invoked even though the documentation suggests that it would be.
The following code only prints "Stopping the actor..." but not "System message!".
implActorforMyActor{typeMsg = MyActorMsg;fnpost_stop(&mutself){println!("Stopping the actor for {}",self.configuration.uri);matchself.schedule_id{Some(schedule_id) => {// TODO: how to cancel the schedule w/o reference to the ActorSystem?// ctx.system.cancel_schedule(schedule_id);}None => {warn!("Stopping the actor without any schedule running");}}}fnsys_recv(&mutself,ctx:&Context<Self::Msg>,msg:SystemMsg,sender:Sender){println!("System message!");}fnrecv(&mutself,ctx:&Context<Self::Msg>,msg:Self::Msg,sender:Sender){self.receive(ctx, msg, sender)}}
The text was updated successfully, but these errors were encountered:
Scenario: my actor registers a schedule and I was under the impression that I should cancel the schedule when the actor is shutting down. Unfortunately,
Actor::post_stop
doesn't have a reference toActorSystem
so I cannot cancel the schedule there.It's possible that schedules for terminated actors get cleaned up automatically but during experimentation I realised that
Actor::sys_recv
doesn't get invoked even though the documentation suggests that it would be.The following code only prints "Stopping the actor..." but not "System message!".
The text was updated successfully, but these errors were encountered: