Skip to content

Commit

Permalink
fix: update db_pid structure in terminate function
Browse files Browse the repository at this point in the history
  • Loading branch information
abc3 committed Oct 31, 2024
1 parent a6cb71f commit 4c6327b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/supavisor/client_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ defmodule Supavisor.ClientHandler do
:ok
end

def terminate(reason, _state, %{db_pid: {_, pid}}) do
def terminate(reason, _state, %{db_pid: {_, pid, _}}) do
db_info =
with {:ok, {state, mode} = resp} <- DbHandler.get_state_and_mode(pid) do
if state == :busy or mode == :session, do: DbHandler.stop(pid)
Expand Down
5 changes: 4 additions & 1 deletion lib/supavisor/db_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ defmodule Supavisor.DbHandler do
end

@spec stop(pid()) :: :ok
def stop(pid), do: :gen_statem.stop(pid, :client_termination, 5_000)
def stop(pid) do
Logger.debug("DbHandler: Stop pid #{inspect(pid)}")
:gen_statem.stop(pid, :client_termination, 5_000)
end

@impl true
def init(args) do
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ defmodule Supavisor.MixProject do

# pooller
# {:poolboy, "~> 1.5.2"},
{:poolboy, git: "https://github.com/abc3/poolboy.git", tag: "v0.0.3"},
{:poolboy, git: "https://github.com/abc3/poolboy.git", tag: "v0.0.2"},
{:syn, "~> 3.3"},
{:pgo, "~> 0.13"},
{:rustler, "~> 0.34.0"},
Expand Down

0 comments on commit 4c6327b

Please sign in to comment.