diff --git a/VERSION b/VERSION index 1f69afba..66c028f6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.61 +1.1.62 diff --git a/lib/supavisor/db_handler.ex b/lib/supavisor/db_handler.ex index dbfe2fbc..e14e59d6 100644 --- a/lib/supavisor/db_handler.ex +++ b/lib/supavisor/db_handler.ex @@ -412,7 +412,8 @@ defmodule Supavisor.DbHandler do end # emulate handle_cast - def handle_event(:cast, {:db_cast, caller, bin}, state, %{sock: sock}) do + def handle_event(:cast, {:db_cast, caller, bin}, state, %{sock: sock}) + when state in [:idle, :busy] do Logger.debug( "DbHandler: state #{state} <-- <-- bin #{inspect(byte_size(bin))} bytes, cast caller: #{inspect(caller)}" ) @@ -421,6 +422,15 @@ defmodule Supavisor.DbHandler do :keep_state_and_data end + def handle_event(:cast, {:db_cast, caller, bin}, state, %{buffer: buff} = data) do + Logger.debug( + "DbHandler: state #{state} <-- <-- bin #{inspect(byte_size(bin))} bytes, cast caller: #{inspect(caller)}" + ) + + new_buff = [bin | buff] + {:keep_state, %{data | caller: caller, buffer: new_buff}} + end + def handle_event(_, {closed, _}, :busy, data) when closed in @sock_closed do {:stop, :db_termination, data} end