Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Supervisors to be stopped #48

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

hoodie
Copy link
Contributor

@hoodie hoodie commented Oct 10, 2021

Hi there,
as described in #27 it would be really nice if Supervisors could be stopped.
I would like to propose to add the .stop_supervisor() method to Addr and Context to achieve this.
In this PR I did the following.

  1. add another ActorEvent called ActorEvent::StopSupervisor which is ignored by normal Actors but obeyed by Supervisors.
    You can now call .stop() to stop the Actor (which will lead to a restart by the supervisor) and .stop_supervisor() which will also stop the Actor but inform the Supervisor to not restart.
  2. Modify the existing example/supervisor_clear_interval.rs
  3. also: I noticed that the Supervisor::start method looked very similar to the Actor::start implementation and since there was already the ActorManager I opted to move them both into the same thing. I took the liberty of renaming it to lifecycle, as the name maybe a bit more familiar.

this fixes #27

Thank you

@hoodie hoodie changed the title Feature/lifecycle Allow Supervisors to bestopped Oct 10, 2021
@hoodie hoodie changed the title Allow Supervisors to bestopped Allow Supervisors to be stopped Oct 10, 2021
@hoodie
Copy link
Contributor Author

hoodie commented Oct 11, 2021

@sunli829 what do you think?

@hoodie
Copy link
Contributor Author

hoodie commented Nov 22, 2021

@sunli829 friendly ping

@hoodie
Copy link
Contributor Author

hoodie commented Jan 21, 2022

@sunli829 another friendly ping, I know these pass unnoticed sometimes on github.
If you're not interested in this crate anymore, I'd be willing to take over maintainership btw.

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.

Supervisors cannot be stopped (formerly "Supervisor causes panic")
1 participant