diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-07-14 17:23:53 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-07-14 17:23:53 +0100 |
commit | 118c40d720fe42fc90c924cb5657f5829667b677 (patch) | |
tree | 11d2dbaa7bef877a032de2b5ab7ac4ea7a3cb4e1 | |
parent | f2c5cd5f7a1f914cab6664f6f8fd97ff5fe7ae6d (diff) | |
download | rabbitmq-server-118c40d720fe42fc90c924cb5657f5829667b677.tar.gz |
It's probably a good idea to reset "restarts" after we get the message, not when we send it; we don't want to jump back into restarting things as normal just because we have scheduled a restart.
-rw-r--r-- | src/supervisor2.erl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl index 90fb0423..4536a72e 100644 --- a/src/supervisor2.erl +++ b/src/supervisor2.erl @@ -680,11 +680,12 @@ handle_info({'EXIT', Pid, Reason}, State) -> handle_info({delayed_restart, {RestartType, Reason, Child}}, State) when ?is_simple(State) -> - try_restart(RestartType, Reason, Child, State); + try_restart(RestartType, Reason, Child, State#state{restarts = []}); handle_info({delayed_restart, {RestartType, Reason, Child}}, State) -> case get_child(Child#child.name, State) of {value, Child1} -> - try_restart(RestartType, Reason, Child1, State); + try_restart(RestartType, Reason, Child1, + State#state{restarts = []}); _What -> {noreply, State} end; @@ -917,7 +918,7 @@ do_restart_delay({RestartType, Delay}, Reason, Child, State) -> _TRef = erlang:send_after(trunc(Delay*1000), self(), {delayed_restart, {{RestartType, Delay}, Reason, Child}}), - {ok, state_del_child(Child, State#state{restarts = []})} + {ok, state_del_child(Child, State)} end. restart(Child, State) -> |