From 2aba7c19d602eca0a62a7a055e574ff0ee0d3ad9 Mon Sep 17 00:00:00 2001 From: Alexander Gorkunov Date: Tue, 9 Apr 2024 19:15:47 +0100 Subject: [PATCH] Do not crash on other signals (e.g. sighup) --- lib/graceful_stop/handler.ex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/graceful_stop/handler.ex b/lib/graceful_stop/handler.ex index 5610a56..2590bdf 100644 --- a/lib/graceful_stop/handler.ex +++ b/lib/graceful_stop/handler.ex @@ -51,9 +51,14 @@ defmodule GracefulStop.Handler do {:ok, state |> set_status(:stopping)} end + def handle_event(_signal, state) do + {:ok, state} + end + def handle_info(:resume, state) do {:ok, state |> set_status(:running)} end + def handle_info(_message, state) do # Logger.info "handle_info: #{inspect message}" {:ok, state}