Re: delayed child restart with incremental back-off
Loïc Hoguin <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Organization | Nine Nines |
| Message-ID | <[email protected]> |
On 03/05/2021 15:52, Tristan Sloughter wrote: >> This articles focuses on initialization, while I am talking about the >> entire lifetime of the process. A process crashing for any reason is >> currently immediately restarted, which in a lot of cases causes tight >> restart loops > > If it is crashing immediately after restart then it sounds like initialization to me? And I don't think it is moot since it changes the concept of supervisors and where/how they are to be used, even if optional. Now that I think about it... gen_statem is usually where I implement this over and over these days, and it already has so many options :), maybe it could be made to more easily support the implementation of certain failures resulting in a state change with a backoff, or some such thing. Yes gen_statem has been very good at making this easier at least. But the problem is of course to have to reimplement this over and over. Perhaps something can be built on top of gen_statem or as part of gen_statem that would make it easier. But it might be difficult to make it generic enough considering you often want to handle other events while the backoff is in progress. It might be easier to just make supervisor do it. The other option I have been thinking about is a module on top of supervisor that would force supervisor to delay the restarts (instead of supervisor starting the process immediately, it tells itself to start it and the module on top of supervisor can delay the real start, or something). That would likely be a better first step. Cheers, -- Loïc Hoguin https://ninenines.eu