mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 23:11:13 +00:00
96816ceaa2
This reverts commitfe7fd33126
, reversing changes made to4fabf83ad0
.
34 lines
790 B
Elixir
34 lines
790 B
Elixir
defmodule Pleroma.Web.Streamer.Supervisor do
|
|
use Supervisor
|
|
|
|
def start_link(opts) do
|
|
Supervisor.start_link(__MODULE__, opts, name: __MODULE__)
|
|
end
|
|
|
|
def init(args) do
|
|
children = [
|
|
{Pleroma.Web.Streamer.State, args},
|
|
{Pleroma.Web.Streamer.Ping, args},
|
|
:poolboy.child_spec(:streamer_worker, poolboy_config())
|
|
]
|
|
|
|
opts = [strategy: :one_for_one, name: Pleroma.Web.Streamer.Supervisor]
|
|
Supervisor.init(children, opts)
|
|
end
|
|
|
|
defp poolboy_config do
|
|
opts =
|
|
Pleroma.Config.get(:streamer,
|
|
workers: 3,
|
|
overflow_workers: 2
|
|
)
|
|
|
|
[
|
|
{:name, {:local, :streamer_worker}},
|
|
{:worker_module, Pleroma.Web.Streamer.Worker},
|
|
{:size, opts[:workers]},
|
|
{:max_overflow, opts[:overflow_workers]}
|
|
]
|
|
end
|
|
end
|