Skip to content

Commit

Permalink
chore: do not call Access twice (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
hauleth authored Jul 8, 2024
1 parent 36c8ac8 commit aaca1cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/supavisor/manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,13 @@ defmodule Supavisor.Manager do

@spec check_parameter_status(map, map) :: :ok | {:error, String.t()}
defp check_parameter_status(ps, def_ps) do
Enum.find_value(ps, :ok, fn {key, value} ->
if def_ps[key] && def_ps[key] != value do
{:error, "Parameter #{key} changed from #{def_ps[key]} to #{value}"}
Enum.find_value(ps, :ok, fn {key, new_value} ->
case def_ps do
%{^key => old_value} when old_value != new_value ->
{:error, "Parameter #{key} changed from #{old_value} to #{new_value}"}

_ ->
nil
end
end)
end
Expand Down

0 comments on commit aaca1cf

Please sign in to comment.