control: do not crash on unavaible HAproxy socket
This commit is contained in:
parent
9915bff2a7
commit
77ebea3746
1 changed files with 7 additions and 2 deletions
|
@ -173,8 +173,13 @@ defmodule HAHandler.Control do
|
||||||
def handle_info(:sync, state) do
|
def handle_info(:sync, state) do
|
||||||
Logger.debug("Executing control logic.")
|
Logger.debug("Executing control logic.")
|
||||||
|
|
||||||
|
case HAProxy.get_stats() do
|
||||||
|
%{} ->
|
||||||
process_pgsql()
|
process_pgsql()
|
||||||
process_drbd()
|
process_drbd()
|
||||||
|
{:error, err} ->
|
||||||
|
Logger.error("Unable to fetch HAProxy state (#{inspect(err)}( - skipping control loop.")
|
||||||
|
end
|
||||||
|
|
||||||
# Schedule next round.
|
# Schedule next round.
|
||||||
Process.send_after(self(), :sync, @refresh)
|
Process.send_after(self(), :sync, @refresh)
|
||||||
|
|
Loading…
Reference in a new issue