Skip to content

Commit df77232

Browse files
committed
Avoid deprecated Elixir syntax
1 parent 93174d0 commit df77232

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/db_connection/backoff.ex

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,31 @@ defmodule DBConnection.Backoff do
3939
end
4040

4141
def backoff(%Backoff{type: :exp, min: min, state: nil} = s) do
42-
{min, %Backoff{s | state: min}}
42+
{min, %{s | state: min}}
4343
end
4444

4545
def backoff(%Backoff{type: :exp, max: max, state: prev} = s) do
4646
require Bitwise
4747
next = min(Bitwise.<<<(prev, 1), max)
48-
{next, %Backoff{s | state: next}}
48+
{next, %{s | state: next}}
4949
end
5050

5151
def backoff(%Backoff{type: :rand_exp, max: max, state: state} = s) do
5252
{prev, lower} = state
5353
next_min = min(prev, lower)
5454
next_max = min(prev * 3, max)
5555
next = rand(next_min, next_max)
56-
{next, %Backoff{s | state: {next, lower}}}
56+
{next, %{s | state: {next, lower}}}
5757
end
5858

5959
@spec reset(t) :: t
6060
def reset(backoff)
6161

6262
def reset(%Backoff{type: :rand} = s), do: s
63-
def reset(%Backoff{type: :exp} = s), do: %Backoff{s | state: nil}
63+
def reset(%Backoff{type: :exp} = s), do: %{s | state: nil}
6464

6565
def reset(%Backoff{type: :rand_exp, min: min, state: {_, lower}} = s) do
66-
%Backoff{s | state: {min, lower}}
66+
%{s | state: {min, lower}}
6767
end
6868

6969
## Internal

0 commit comments

Comments
 (0)