[erlang-questions] How to make a supervisor wait before restarting children

Loïc Hoguin <>
Wed Sep 12 12:11:33 CEST 2012


On 09/12/2012 11:58 AM, Florian Odronitz wrote:
> Hi List,
>
> I am writing an application to talk to a database server. The supervisor starts a bunch of workers which connect to the db.
> When the db is not available, the workers crash and are restarted by the backend. If the workers crash too often, the supervisor dies according to the restart strategy. When the db comes up again after a couple of minutes, the supervisor is long dead.

What I do is that if it fails when connecting, the worker sends itself a 
message to try to connect again a few seconds later.

-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the erlang-questions mailing list