-
Notifications
You must be signed in to change notification settings - Fork 4
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
OneForAll strategy #11
Comments
So I've been looking into implementing this, and what gives me trouble is that RestartStrategy bundles both the RetryStatus and the actual strategy (e.g. OneForOne, etc.). As a consequence, if I understand this correctly (please correct me if I'm wrong), the strategy on how to restart is actually linked to the individual child process. If you look at how Erlang implements it, you'll see that the strategy with which to restart children is on a supervisor level, and retry state is maintained on a per-child basis. i.e. if a child terminates, we want to be looking at what the strategy of the supervisor is to deal with this, rather than what strategy is linked to the child that died. The changes necessary to implement this (from my perspective) would be that Since those would be breaking changes (and we would necessarily also need to change the way a supervisor is constructed), could you have a look @adinapoli and tell me if there's a simpler option in your mind? |
Hey @srijs ! I will look at this during off hours (it's quite unfortunate that during our timezones your hacking time matches my working hours 😉 ). What I can tell you, on top of my mind, after months of not touching this code, is (I will refine this later once I refresh my brain):
|
Thanks for taking the time to comment. I like your attitude :) I'm looking forward to hearing more from you later. In the meantime, I'll try to open a PR with the changes as I would propose them. It is almost always better to be able to talk about something that is concrete :) |
No problem at all! Thanks for contributing, it's really nice to see this library moving forward 😉 Later! |
Thinking further regarding this feature, I think we might need to introduce something like "epochs" for the children of a supervisor and the events that are emitted from it. Here's the problem that it would be solving:
By introducing epochs, each supervisor would track an increasing number (the epoch) for each child. Whenever it decides to restart (or terminate) a child, it increases the epoch for it. What do you think, @adinapoli? |
Hey @srijs ! I think that what you are proposing makes a great deal of sense, but just to play the devil's advocate a bit, are you aware if the Erlang OTP does something similar or it's a novel approach? Generally speaking might be good to see what they do to rely on proved, battle-tested models! Said that, I have also jotted down a couple of caffeine-deprived thoughts on the shape of the library here: Please chime in 😉 |
No description provided.
The text was updated successfully, but these errors were encountered: