diff options
Diffstat (limited to 'src/rabbit_autoheal.erl')
-rw-r--r-- | src/rabbit_autoheal.erl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rabbit_autoheal.erl b/src/rabbit_autoheal.erl index b631d9c9..3aa32c09 100644 --- a/src/rabbit_autoheal.erl +++ b/src/rabbit_autoheal.erl @@ -83,7 +83,7 @@ enabled() -> %% stopped - all nodes can now start again rabbit_down(Node, {winner_waiting, [Node], Notify}) -> rabbit_log:info("Autoheal: final node has stopped, starting...~n",[]), - [{rabbit_outside_app_process, N} ! autoheal_safe_to_start || N <- Notify], + notify_safe(Notify), not_healing; rabbit_down(Node, {winner_waiting, WaitFor, Notify}) -> @@ -95,6 +95,14 @@ rabbit_down(_Node, State) -> node_down(_Node, not_healing) -> not_healing; + +node_down(Node, {winner_waiting, _, Notify}) -> + rabbit_log:info("Autoheal: aborting - ~p went down~n", [Node]), + %% Make sure any nodes waiting for us start - it won't necessarily + %% heal the partition but at least they won't get stuck. + notify_safe(Notify), + not_healing; + node_down(Node, _State) -> rabbit_log:info("Autoheal: aborting - ~p went down~n", [Node]), not_healing. @@ -162,6 +170,9 @@ handle_msg(_, restarting, _Partitions) -> send(Node, Msg) -> {?SERVER, Node} ! {autoheal_msg, Msg}. +notify_safe(Notify) -> + [{rabbit_outside_app_process, N} ! autoheal_safe_to_start || N <- Notify]. + make_decision(AllPartitions) -> Sorted = lists:sort([{partition_value(P), P} || P <- AllPartitions]), [[Winner | _] | Rest] = lists:reverse([P || {_, P} <- Sorted]), |