logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

pool.ex (666B)


      1 # Pleroma: A lightweight social networking server
      2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
      3 # SPDX-License-Identifier: AGPL-3.0-only
      4 
      5 defmodule Pleroma.Pool do
      6   def child_spec(opts) do
      7     poolboy_opts =
      8       opts
      9       |> Keyword.put(:worker_module, Pleroma.Pool.Request)
     10       |> Keyword.put(:name, {:local, opts[:name]})
     11       |> Keyword.put(:size, opts[:size])
     12       |> Keyword.put(:max_overflow, opts[:max_overflow])
     13 
     14     %{
     15       id: opts[:id] || {__MODULE__, make_ref()},
     16       start: {:poolboy, :start_link, [poolboy_opts, [name: opts[:name]]]},
     17       restart: :permanent,
     18       shutdown: 5000,
     19       type: :worker
     20     }
     21   end
     22 end