Skip to content

Commit

Permalink
fix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
chasers committed Nov 26, 2024
1 parent 4c8bc47 commit 3450c71
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/supavisor/client_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ defmodule Supavisor.ClientHandler do
def handle_event(:internal, :subscribe, _, data) do
Logger.debug("ClientHandler: Subscribe to tenant #{inspect(data.id)}")

manager_ref = Process.monitor(opts.workers.manager)

Check warning on line 387 in lib/supavisor/client_handler.ex

View workflow job for this annotation

GitHub Actions / Dialyze

variable "opts" does not exist and is being expanded to "opts()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 387 in lib/supavisor/client_handler.ex

View workflow job for this annotation

GitHub Actions / Dialyze

** (CompileError) lib/supavisor/client_handler.ex:387: undefined function opts/0 (expected Supavisor.ClientHandler to define such a function or for it to be imported, but none are available)

Check warning on line 387 in lib/supavisor/client_handler.ex

View workflow job for this annotation

GitHub Actions / Run integration tests

variable "opts" does not exist and is being expanded to "opts()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 387 in lib/supavisor/client_handler.ex

View workflow job for this annotation

GitHub Actions / Run integration tests

** (CompileError) lib/supavisor/client_handler.ex:387: undefined function opts/0 (expected Supavisor.ClientHandler to define such a function or for it to be imported, but none are available)

Check warning on line 387 in lib/supavisor/client_handler.ex

View workflow job for this annotation

GitHub Actions / Run tests

variable "opts" does not exist and is being expanded to "opts()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 387 in lib/supavisor/client_handler.ex

View workflow job for this annotation

GitHub Actions / Run tests

** (CompileError) lib/supavisor/client_handler.ex:387: undefined function opts/0 (expected Supavisor.ClientHandler to define such a function or for it to be imported, but none are available)
data = %{data | manager: manager_ref}

with {:ok, sup} <-
Supavisor.start_dist(data.id, data.auth_secrets,
log_level: data.log_level,
Expand All @@ -395,10 +398,9 @@ defmodule Supavisor.ClientHandler do
else: true
),
{:ok, opts} <- Supavisor.subscribe(sup, data.id) do
manager_ref = Process.monitor(opts.workers.manager)
data = Map.merge(data, opts.workers)
db_pid = db_checkout(:both, :on_connect, data)
data = %{data | manager: manager_ref, db_pid: db_pid, idle_timeout: opts.idle_timeout}
data = %{data | db_pid: db_pid, idle_timeout: opts.idle_timeout}

next =
if opts.ps == [],
Expand All @@ -424,8 +426,6 @@ defmodule Supavisor.ClientHandler do
:proxy ->
case Supavisor.get_pool_ranch(data.id) do
{:ok, %{port: port, host: host}} ->
manager_ref = Process.monitor(opts.workers.manager)

auth =
Map.merge(data.auth, %{
port: port,
Expand All @@ -436,8 +436,7 @@ defmodule Supavisor.ClientHandler do
upstream_verify: nil
})

{:keep_state, %{data | auth: auth, manager: manager_ref},
{:next_event, :internal, :connect_db}}
{:keep_state, %{data | auth: auth}, {:next_event, :internal, :connect_db}}

other ->
Logger.error("ClientHandler: Subscribe proxy error: #{inspect(other)}")
Expand Down

0 comments on commit 3450c71

Please sign in to comment.