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

Bump styler from 1.3.3 to 1.4.0 #135

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions lib/poolex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
alias Poolex.Private.State
alias Poolex.Private.WaitingCallers

@default_checkout_timeout :timer.seconds(5)
@default_checkout_timeout to_timeout(second: 5)

Check failure on line 38 in lib/poolex.ex

View workflow job for this annotation

GitHub Actions / OTP 24 / Elixir 1.12

** (CompileError) lib/poolex.ex:38: undefined function to_timeout/1

Check failure on line 38 in lib/poolex.ex

View workflow job for this annotation

GitHub Actions / OTP 25 / Elixir 1.13

** (CompileError) lib/poolex.ex:38: undefined function to_timeout/1 (there is no such import)

Check failure on line 38 in lib/poolex.ex

View workflow job for this annotation

GitHub Actions / OTP 25 / Elixir 1.14

** (CompileError) lib/poolex.ex:38: undefined function to_timeout/1 (there is no such import)
@poolex_options_table """
| Option | Description | Example | Default value |
|------------------------|------------------------------------------------------|-----------------------|-----------------------------------|
Expand Down Expand Up @@ -370,7 +370,7 @@
|> Monitoring.add(new_worker, :worker)
|> BusyWorkers.add(new_worker)

{:reply, {:ok, new_worker}, %State{state | overflow: state.overflow + 1}}
{:reply, {:ok, new_worker}, %{state | overflow: state.overflow + 1}}
else
state =
state
Expand Down Expand Up @@ -494,7 +494,7 @@

if WaitingCallers.empty?(state) do
if state.overflow > 0 do
%State{state | overflow: state.overflow - 1}
%{state | overflow: state.overflow - 1}
else
{:ok, new_worker} = start_worker(state)

Expand Down
6 changes: 3 additions & 3 deletions lib/poolex/private/busy_workers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ defmodule Poolex.Private.BusyWorkers do
@doc false
@spec init(State.t(), busy_workers_impl :: module()) :: State.t()
def init(%State{} = state, impl) do
%State{state | busy_workers_impl: impl, busy_workers_state: impl.init()}
%{state | busy_workers_impl: impl, busy_workers_state: impl.init()}
end

@doc false
@spec add(State.t(), Poolex.worker()) :: State.t()
def add(%State{busy_workers_impl: impl, busy_workers_state: busy_workers_state} = state, worker) do
%State{state | busy_workers_state: impl.add(busy_workers_state, worker)}
%{state | busy_workers_state: impl.add(busy_workers_state, worker)}
end

@doc false
Expand All @@ -24,7 +24,7 @@ defmodule Poolex.Private.BusyWorkers do
@doc false
@spec remove(State.t(), Poolex.worker()) :: State.t()
def remove(%State{busy_workers_impl: impl, busy_workers_state: busy_workers_state} = state, worker) do
%State{state | busy_workers_state: impl.remove(busy_workers_state, worker)}
%{state | busy_workers_state: impl.remove(busy_workers_state, worker)}
end

@doc false
Expand Down
8 changes: 4 additions & 4 deletions lib/poolex/private/idle_workers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ defmodule Poolex.Private.IdleWorkers do
@doc false
@spec init(State.t(), idle_workers_impl :: module(), list(Poolex.worker())) :: State.t()
def init(%State{} = state, impl, workers) do
%State{state | idle_workers_impl: impl, idle_workers_state: impl.init(workers)}
%{state | idle_workers_impl: impl, idle_workers_state: impl.init(workers)}
end

@doc false
@spec add(State.t(), Poolex.worker()) :: State.t()
def add(%State{idle_workers_impl: impl, idle_workers_state: idle_workers_state} = state, worker) do
%State{state | idle_workers_state: impl.add(idle_workers_state, worker)}
%{state | idle_workers_state: impl.add(idle_workers_state, worker)}
end

@doc false
@spec remove(State.t(), Poolex.worker()) :: State.t()
def remove(%State{idle_workers_impl: impl, idle_workers_state: idle_workers_state} = state, worker) do
%State{state | idle_workers_state: impl.remove(idle_workers_state, worker)}
%{state | idle_workers_state: impl.remove(idle_workers_state, worker)}
end

@doc false
Expand All @@ -44,7 +44,7 @@ defmodule Poolex.Private.IdleWorkers do
def pop(%State{idle_workers_impl: impl, idle_workers_state: idle_workers_state} = state) do
case impl.pop(idle_workers_state) do
{worker, new_idle_workers_state} ->
{worker, %State{state | idle_workers_state: new_idle_workers_state}}
{worker, %{state | idle_workers_state: new_idle_workers_state}}

:empty ->
:empty
Expand Down
2 changes: 1 addition & 1 deletion lib/poolex/private/metrics.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ defmodule Poolex.Private.Metrics do
else
:telemetry_poller.start_link(
measurements: measurements,
period: :timer.seconds(1),
period: to_timeout(second: 1),
name: :"#{pool_id}_metrics_poller"
)
end
Expand Down
10 changes: 5 additions & 5 deletions lib/poolex/private/waiting_callers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ defmodule Poolex.Private.WaitingCallers do
@doc false
@spec init(State.t(), waiting_callers_impl :: module()) :: State.t()
def init(%State{} = state, impl) do
%State{state | waiting_callers_impl: impl, waiting_callers_state: impl.init()}
%{state | waiting_callers_impl: impl, waiting_callers_state: impl.init()}
end

@doc false
@spec add(State.t(), Poolex.Caller.t()) :: State.t()
def add(%State{waiting_callers_impl: impl, waiting_callers_state: waiting_callers_state} = state, caller) do
%State{state | waiting_callers_state: impl.add(waiting_callers_state, caller)}
%{state | waiting_callers_state: impl.add(waiting_callers_state, caller)}
end

@doc false
Expand All @@ -26,7 +26,7 @@ defmodule Poolex.Private.WaitingCallers do
def pop(%State{waiting_callers_impl: impl, waiting_callers_state: waiting_callers_state} = state) do
case impl.pop(waiting_callers_state) do
{caller, new_waiting_callers_state} ->
{caller, %State{state | waiting_callers_state: new_waiting_callers_state}}
{caller, %{state | waiting_callers_state: new_waiting_callers_state}}

:empty ->
:empty
Expand All @@ -36,7 +36,7 @@ defmodule Poolex.Private.WaitingCallers do
@doc false
@spec remove_by_pid(State.t(), caller_pid :: pid()) :: State.t()
def remove_by_pid(%State{waiting_callers_impl: impl, waiting_callers_state: waiting_callers_state} = state, caller) do
%State{state | waiting_callers_state: impl.remove_by_pid(waiting_callers_state, caller)}
%{state | waiting_callers_state: impl.remove_by_pid(waiting_callers_state, caller)}
end

@doc false
Expand All @@ -45,7 +45,7 @@ defmodule Poolex.Private.WaitingCallers do
%State{waiting_callers_impl: impl, waiting_callers_state: waiting_callers_state} = state,
reference
) do
%State{
%{
state
| waiting_callers_state: impl.remove_by_reference(waiting_callers_state, reference)
}
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.2", "03e1804074b3aa64d5fad7aa64601ed0fb395337b982d9bcf04029d68d51b6a7", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "af33ff7ef368d5893e4a267933e7744e46ce3cf1f61e2dccf53a111ed3aa3727"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [:mix], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"},
"styler": {:hex, :styler, "1.3.3", "5196fc9e9bf1254af4337b051103d38532c2f500b0f01bc6f53f56ee678f65e6", [:mix], [], "hexpm", "c275f73f2ff1b7dfafb03a0f8cf3e928709a235a2b049162b40168f53ba3a07c"},
"styler": {:hex, :styler, "1.4.0", "5944723d08afe4d38210b674d7e97dd1137a75968a85a633983cc308e86dc5f2", [:mix], [], "hexpm", "07de0e89c27490c8e469bb814d77ddaaa3283d7d8038501021d80a7705cf13e9"},
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
"telemetry_poller": {:hex, :telemetry_poller, "1.1.0", "58fa7c216257291caaf8d05678c8d01bd45f4bdbc1286838a28c4bb62ef32999", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9eb9d9cbfd81cbd7cdd24682f8711b6e2b691289a0de6826e58452f28c103c8f"},
}
18 changes: 9 additions & 9 deletions test/poolex_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ defmodule PoolexTest do
spawn(fn ->
Poolex.run(pool_name, fn _pid ->
Process.send(test_process, nil, [])
:timer.sleep(:timer.seconds(5))
:timer.sleep(to_timeout(second: 5))
end)
end)

Expand Down Expand Up @@ -175,7 +175,7 @@ defmodule PoolexTest do
spawn(fn ->
Poolex.run(pool_name, fn _pid ->
Process.send(test_process, nil, [])
:timer.sleep(:timer.seconds(5))
:timer.sleep(to_timeout(second: 5))
end)
end)

Expand Down Expand Up @@ -224,14 +224,14 @@ defmodule PoolexTest do

Enum.each(1..10, fn _ ->
spawn(fn ->
Poolex.run(pool_name, fn pid -> GenServer.call(pid, {:do_some_work_with_delay, :timer.seconds(4)}) end)
Poolex.run(pool_name, fn pid -> GenServer.call(pid, {:do_some_work_with_delay, to_timeout(second: 4)}) end)
end)
end)

waiting_caller =
spawn(fn ->
Poolex.run(pool_name, fn pid ->
GenServer.call(pid, {:do_some_work_with_delay, :timer.seconds(3)})
GenServer.call(pid, {:do_some_work_with_delay, to_timeout(second: 3)})
end)
end)

Expand Down Expand Up @@ -261,7 +261,7 @@ defmodule PoolexTest do
caller =
spawn(fn ->
Poolex.run(pool_name, fn pid ->
GenServer.call(pid, {:do_some_work_with_delay, :timer.seconds(4)})
GenServer.call(pid, {:do_some_work_with_delay, to_timeout(second: 4)})
end)
end)

Expand All @@ -288,7 +288,7 @@ defmodule PoolexTest do
caller =
spawn(fn ->
Poolex.run(pool_name, fn pid ->
GenServer.call(pid, {:do_some_work_with_delay, :timer.seconds(4)})
GenServer.call(pid, {:do_some_work_with_delay, to_timeout(second: 4)})
end)
end)

Expand Down Expand Up @@ -335,7 +335,7 @@ defmodule PoolexTest do
Poolex.run(
pool_name,
fn pid ->
GenServer.call(pid, {:do_some_work_with_delay, :timer.seconds(4)})
GenServer.call(pid, {:do_some_work_with_delay, to_timeout(second: 4)})
end,
checkout_timeout: 100
)
Expand Down Expand Up @@ -365,7 +365,7 @@ defmodule PoolexTest do
result =
Poolex.run(
pool_name,
fn pid -> GenServer.call(pid, {:do_some_work_with_delay, :timer.seconds(4)}) end,
fn pid -> GenServer.call(pid, {:do_some_work_with_delay, to_timeout(second: 4)}) end,
checkout_timeout: 100
)

Expand Down Expand Up @@ -470,7 +470,7 @@ defmodule PoolexTest do
result =
Poolex.run(
pool_name,
fn pid -> GenServer.call(pid, {:do_some_work_with_delay, :timer.seconds(4)}) end,
fn pid -> GenServer.call(pid, {:do_some_work_with_delay, to_timeout(second: 4)}) end,
checkout_timeout: 100
)

Expand Down
4 changes: 2 additions & 2 deletions test/support/pool_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ defmodule PoolHelpers do
end

@spec launch_long_task(Poolex.pool_id(), timeout()) :: :ok
def launch_long_task(pool_id, delay \\ :timer.seconds(4)) do
def launch_long_task(pool_id, delay \\ to_timeout(second: 4)) do
launch_long_tasks(pool_id, 1, delay)
end

@spec launch_long_tasks(Poolex.pool_id(), non_neg_integer(), timeout()) :: :ok
def launch_long_tasks(pool_id, count, delay \\ :timer.seconds(4)) do
def launch_long_tasks(pool_id, count, delay \\ to_timeout(second: 4)) do
for _i <- 1..count do
spawn(fn ->
Poolex.run(
Expand Down
Loading