summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2012-03-22 12:11:58 +0000
committerMatthew Sackman <matthew@rabbitmq.com>2012-03-22 12:11:58 +0000
commitbf2274252d423b96901577e72d1bcfca830223f6 (patch)
tree1b05d9d34e8b8a4884fae19e141abe3ed57946aa
parentb983d5dafe4cba0204cd70bf2be991d4cf8e2349 (diff)
downloadrabbitmq-server-bf2274252d423b96901577e72d1bcfca830223f6.tar.gz
Accomodate a desire to avoid polluting the logs
-rw-r--r--src/supervisor2.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl
index 774b7007..8dd8aba8 100644
--- a/src/supervisor2.erl
+++ b/src/supervisor2.erl
@@ -31,6 +31,16 @@
%% the MaxT and MaxR parameters to permit the child to be
%% restarted. This may require waiting for longer than Delay.
%%
+%% Sometimes, you may wish for a transient or intrinsic child to
+%% exit abnormally so that it gets restarted, but still log
+%% nothing. gen_server will log any exit reason other than
+%% 'normal', 'shutdown' or {'shutdown', _}. Thus the exit reason of
+%% {'shutdown', 'restart'} is interpreted to mean you wish the
+%% child to be restarted according to the delay parameters, but
+%% gen_server will not log the error. Thus from gen_server's
+%% perspective it's a normal exit, whilst from supervisor's
+%% perspective, it's an abnormal exit.
+%%
%% 4) Added an 'intrinsic' restart type. Like the transient type, this
%% type means the child should only be restarted if the child exits
%% abnormally. Unlike the transient type, if the child exits
@@ -536,6 +546,9 @@ do_restart(permanent, Reason, Child, State) ->
restart(Child, State);
do_restart(Type, normal, Child, State) ->
del_child_and_maybe_shutdown(Type, Child, State);
+do_restart({RestartType, Delay}, {shutdown, restart} = Reason, Child, State)
+ when RestartType =:= transient orelse RestartType =:= intrinsic ->
+ do_restart_delay({RestartType, Delay}, Reason, Child, State);
do_restart(Type, {shutdown, _}, Child, State) ->
del_child_and_maybe_shutdown(Type, Child, State);
do_restart(Type, shutdown, Child = #child{child_type = supervisor}, State) ->