Hello,
Is it possible to set a max_restarts on the worker module in the poolboy child spec? It appears they use the default of three, but I want to be able to configure that number. I tried abstracting the connect pool into its own supervisor then set the max_restrats on that supervisor, but when I crash the pid it still restarts only three times max. Any advice?
defmodule PoolSupervisor do
use Supervisor
require Logger
def start_link do
# Supervisor.start_link(__MODULE__, nil, name: :config_server_supervisor)
Supervisor.start_link(__MODULE__, [], name: __MODULE__)
end
def init(_) do
connection_pool_config = [
{:name, {:local, :inventory}},
{:worker_module, ConnectionPoolWorker},
{:size, 2},
{:max_overflow, 1}
]
children = [
:poolboy.child_spec(:inventory, connection_pool_config, :inventory)
]
supervise(children, strategy: :one_for_one, max_restarts: 500, max_seconds: 1)
end
end