Skip to content

Commit

Permalink
Ensure module is loaded (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaaaaaSharp authored Feb 26, 2024
1 parent 17a36c9 commit 4f6aaae
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/nimble_pool.ex
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,15 @@ defmodule NimblePool do
@impl true
def init({worker, arg, pool_size, lazy, worker_idle_timeout, max_idle_pings}) do
Process.flag(:trap_exit, true)
_ = Code.ensure_loaded(worker)

case Code.ensure_loaded(worker) do
{:module, _} ->
:ok

{:error, reason} ->
raise ArgumentError, "failed to load worker module #{inspect(worker)}: #{inspect(reason)}"
end

lazy = if lazy, do: pool_size, else: nil

if worker_idle_timeout do
Expand Down

0 comments on commit 4f6aaae

Please sign in to comment.