Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mark :db_termination as shutdown #475

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/supavisor/db_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
tenant = if data.proxy, do: Supavisor.tenant(data.id)
search_path = Supavisor.search_path(data.id)

case send_startup(sock, auth, tenant, search_path) do

Check warning on line 128 in lib/supavisor/db_handler.ex

View workflow job for this annotation

GitHub Actions / Code style

Function body is nested too deep (max depth is 2, was 3).
:ok ->
:ok = activate(sock)
{:next_state, :authentication, %{data | sock: sock}}
Expand Down Expand Up @@ -343,15 +343,15 @@
end

def handle_event(_, {closed, _}, :busy, data) when closed in @sock_closed do
{:stop, :db_termination, data}
{:stop, {:shutdown, :db_termination}, data}
end

def handle_event(_, {closed, _}, state, data) when closed in @sock_closed do
Logger.error("DbHandler: Connection closed when state was #{state}")

if Application.get_env(:supavisor, :reconnect_on_db_close),
do: {:next_state, :connect, data, {:state_timeout, reconnect_timeout(data), :connect}},
else: {:stop, :db_termination, data}
else: {:stop, {:shutdown, :db_termination}, data}
end

# linked client_handler went down
Expand Down
Loading