From 9797086ed2fbc74578eb0ab45a7dfbffb7f5d082 Mon Sep 17 00:00:00 2001 From: Stas Date: Mon, 2 Dec 2024 19:15:22 +0100 Subject: [PATCH] fix: match protocols with the info message (#504) --- lib/supavisor/client_handler.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/supavisor/client_handler.ex b/lib/supavisor/client_handler.ex index b1e06c61..72c570bd 100644 --- a/lib/supavisor/client_handler.ex +++ b/lib/supavisor/client_handler.ex @@ -545,7 +545,7 @@ defmodule Supavisor.ClientHandler do # incoming query with a single pool def handle_event(:info, {proto, _, bin}, :idle, %{pool: pid} = data) - when is_binary(bin) and is_pid(pid) do + when is_binary(bin) and is_pid(pid) and proto in @proto do Logger.debug("ClientHandler: Receive query #{inspect(bin)}") db_pid = db_checkout(:both, :on_query, data) handle_prepared_statements(db_pid, bin, data) @@ -554,13 +554,13 @@ defmodule Supavisor.ClientHandler do {:next_event, :internal, {proto, nil, bin}}} end - def handle_event(:info, {proto, _, bin}, _, %{mode: :proxy} = data) do + def handle_event(:info, {proto, _, bin}, _, %{mode: :proxy} = data) when proto in @proto do {:next_state, :busy, %{data | query_start: System.monotonic_time()}, {:next_event, :internal, {proto, nil, bin}}} end # incoming query with read/write pools - def handle_event(:info, {proto, _, bin}, :idle, data) do + def handle_event(:info, {proto, _, bin}, :idle, data) when proto in @proto do query_type = with {:ok, payload} <- Client.get_payload(bin), {:ok, statements} <- Supavisor.PgParser.statements(payload) do