Erlang Manager Restart Interval

I have a dispatcher with one one_for_one restart strategy. Is it possible to set the time interval between rebooting child processes?

Fe deleted db is shredded and I want to wait 10 seconds between attempts to reconnect.

+7
source share
1 answer

In fact, you can let the supervisor immediately restart its children and implement the so-called lazy initialization:

  • The supervisor (re) runs (immediately) a child (say gen_server)
  • gen_server returns timeout 0 in its init function
  • In handle_info, you activate the wait (10 seconds) to ensure that the DB is properly initialized.

Thus, you guarantee that all requests to gen_server are processed after the database is correctly initialized.

+4
source

All Articles