diff options
| author | Emile Joubert <emile@rabbitmq.com> | 2011-11-01 16:47:29 +0000 |
|---|---|---|
| committer | Emile Joubert <emile@rabbitmq.com> | 2011-11-01 16:47:29 +0000 |
| commit | caa744fc478191b0af7babcb5de5d68934a41424 (patch) | |
| tree | 627867cbfc8b9e9fc6558d40320f6bd534d9d1b3 /src | |
| parent | 2a979749ccd6c0cc1f6612ae19aded3685113b63 (diff) | |
| download | rabbitmq-server-git-caa744fc478191b0af7babcb5de5d68934a41424.tar.gz | |
Refactor supervisor shutdown
Diffstat (limited to 'src')
| -rw-r--r-- | src/supervisor2.erl | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl index 27115e2279..1f75840567 100644 --- a/src/supervisor2.erl +++ b/src/supervisor2.erl @@ -685,11 +685,7 @@ terminate_simple_children(Child, Dynamics, SupName) -> end end, {dict:new(), false}, Pids), timer:cancel(TRef), - RestartPerm = case Child#child.restart_type of - permanent -> true; - {permanent, _Delay} -> true; - _ -> false - end, + RestartPerm = restart_permanent(Child#child.restart_type), ReportAcc = fun (NormalErrorFun) -> fun (Pid, ok, Acc) -> Acc; @@ -711,16 +707,19 @@ terminate_simple_children(Child, Dynamics, SupName) -> end, ok, Replies), ok. +restart_permanent(permanent) -> true; +restart_permanent({permanent, _Delay}) -> true; +restart_permanent(_) -> false; + do_terminate(Child, SupName) when Child#child.pid =/= undefined -> ReportError = shutdown_error_reporter(SupName), case shutdown(Child#child.pid, Child#child.shutdown) of ok -> ok; {error, normal} -> - case Child#child.restart_type of - permanent -> ReportError(normal, Child); - {permanent, _Delay} -> ReportError(normal, Child); - _ -> ok + case restart_permanent(Child#child.restart_type) of + true -> ReportError(normal, Child); + false -> ok end; {error, OtherReason} -> ReportError(OtherReason, Child) |
