control: do not crash on unavaible HAproxy socket

This commit is contained in:
Timothée Floure 2022-05-22 13:03:58 +02:00
parent 9915bff2a7
commit 77ebea3746
Signed by: tfloure
GPG key ID: 4502C902C00A1E12

View file

@ -173,8 +173,13 @@ defmodule HAHandler.Control do
def handle_info(:sync, state) do
Logger.debug("Executing control logic.")
case HAProxy.get_stats() do
%{} ->
process_pgsql()
process_drbd()
{:error, err} ->
Logger.error("Unable to fetch HAProxy state (#{inspect(err)}( - skipping control loop.")
end
# Schedule next round.
Process.send_after(self(), :sync, @refresh)