[erlang-questions] catch supervisor failure
Fri Aug 26 08:08:57 CEST 2011
I'm not aware of any way to implement the "wait 10 minutes" logic in the standard supervisor pattern.
The way we've handled something like this in the past is to have a separate gen_server running higher up the tree that the server (the url fetcher in your example) calls into at startup. This gen_server keeps track of how many initialisations there have been, and performs timer:sleep()s as appropriate - in our scenario, it was a simple exponential back off algorithm.
Not particularly pretty, but it did drop in with almost no change to the rest of the system. Some sort of supervisor callback at termination time would be much more preferable, but I don't know of a mechanism for that - would be glad to hear other suggestions!
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Friday, 26 August 2011 at 07:56, Max Lapshin wrote:
> On Fri, Aug 26, 2011 at 9:47 AM, Bengt Kleberg
> < (mailto:)> wrote:
> > Would it be possible to have a supervisor between the master supervisor
> > and the one that dies?
> > This new supervisor could handle the behavior you described before, but
> > has gotten lost from this email. It was something about 1 minute, I
> > think.
> I can add as much supervisors as required. But I don't understand how
> to write my own callback, that will be called if some child
> of supervisor is dead.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions