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: cleanup warnings #420

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
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
28 changes: 14 additions & 14 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion lib/supavisor/client_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
{:stop, {:shutdown, :invalid_characters}}
else
log_level =
case hello.payload["options"]["log_level"] do

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

View workflow job for this annotation

GitHub Actions / Code style

Function body is nested too deep (max depth is 2, was 3).
nil -> nil
level -> String.to_existing_atom(level)
end
Expand Down Expand Up @@ -263,7 +263,7 @@

key = {:secrets, tenant_or_alias, user}

case auth_secrets(info, user, key, :timer.hours(24)) do

Check warning on line 266 in lib/supavisor/client_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, auth_secrets} ->
Logger.debug("ClientHandler: Authentication method: #{inspect(auth_secrets)}")

Expand Down Expand Up @@ -322,7 +322,7 @@
Cachex.get(Supavisor.Cache, key) == {:ok, nil} do
case auth_secrets(info, data.user, key, 15_000) do
{:ok, {method2, secrets2}} = value ->
if method != method2 or Map.delete(secrets.(), :client_key) != secrets2.() do

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

View workflow job for this annotation

GitHub Actions / Code style

Function body is nested too deep (max depth is 2, was 4).
Logger.warning("ClientHandler: Update secrets and terminate pool")

Cachex.update(
Expand Down Expand Up @@ -618,7 +618,10 @@
{:next_state, :idle, %{data | db_pid: db_pid, stats: stats}, handle_actions(data)}

:read_sql_error ->
Logger.error("ClientHandler: read only sql transaction, reruning the query to write pool")
Logger.error(
"ClientHandler: read only sql transaction, rerunning the query to write pool"
)

# release the read pool
_ = handle_db_pid(data.mode, data.pool, data.db_pid)

Expand Down
4 changes: 2 additions & 2 deletions lib/supavisor/manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ defmodule Supavisor.Manager do
use GenServer, restart: :transient
require Logger

alias Supavisor.Helpers, as: H
alias Supavisor.Protocol.Server
alias Supavisor.Tenants
alias Supavisor.Helpers

@check_timeout 120_000

Expand Down Expand Up @@ -34,7 +34,7 @@ defmodule Supavisor.Manager do

@impl true
def init(args) do
H.set_log_level(args.log_level)
Helpers.set_log_level(args.log_level)
tid = :ets.new(__MODULE__, [:protected])

[args | _] = Enum.filter(args.replicas, fn e -> e.replica_type == :write end)
Expand Down
Loading