I have a supervisor with one_for_one
restart strategy.
Is it possible to set some time interval between child process restarting?
For example, the remote db crushed and I want to wait 10 seconds between restore connection attempts.
I have a supervisor with one_for_one
restart strategy.
Is it possible to set some time interval between child process restarting?
For example, the remote db crushed and I want to wait 10 seconds between restore connection attempts.
Actually, you could let the supervisor to immediately restart its children and implement what is called lazy initialization:
This way, you ensure that all requests to the gen_server are processed after the DB is properly initialized.
You can't do that with standard supervisor
behaviour, you need to implement your own sup
as a gen_server
which trap exits from others than its parent
and restarts manually their childs, but which also check each time before restarting a child that the 10 seconds are expired by setting a timeout