Packages

🙅‍♂️ The younger & more energetic version of :poolboy

Current section

Files

Jump to
pool_lad lib test_app.ex
Raw

lib/test_app.ex

defmodule App do
use Application
defmodule SampleWorker do
@moduledoc false
use GenServer
@this_module __MODULE__
def start_link(opts), do: GenServer.start_link(@this_module, opts)
@impl true
def init(opts) do
# Maintain init opts in state for later introspection.
{:ok, opts}
end
end
def start(_type, _args) do
pool_opts = [
name: SampleWorkerPool,
worker_count: 3,
worker_module: SampleWorker
]
worker_opts = [ref: make_ref()]
children = [
PoolLad.child_spec(pool_opts, worker_opts)
]
opts = [strategy: :one_for_one, name: App.Supervisor]
Supervisor.start_link(children, opts)
end
end