diff --git a/lib/pleroma/application/chat_supervisor.ex b/lib/pleroma/application/chat_supervisor.ex new file mode 100644 index 000000000..4b6f0e740 --- /dev/null +++ b/lib/pleroma/application/chat_supervisor.ex @@ -0,0 +1,19 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Application.ChatSupervisor do + use Supervisor + + def start_link(_) do + Supervisor.start_link(__MODULE__, :no_args) + end + + def init(_) do + [ + Pleroma.Web.ChatChannel.ChatChannelState, + {Phoenix.PubSub, [name: Pleroma.PubSub, adapter: Phoenix.PubSub.PG2]} + ] + |> Supervisor.init(strategy: :one_for_one) + end +end diff --git a/lib/pleroma/application/config_dependent_deps.ex b/lib/pleroma/application/config_dependent_deps.ex index b2b6bd845..aad6c0086 100644 --- a/lib/pleroma/application/config_dependent_deps.ex +++ b/lib/pleroma/application/config_dependent_deps.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Application.ConfigDependentDeps do require Logger @config_path_mods_relation [ - {{:pleroma, :chat}, Pleroma.Web.ChatChannel.ChatChannelState}, + {{:pleroma, :chat}, Pleroma.Application.ChatSupervisor}, {{:pleroma, Oban}, Oban}, {{:pleroma, :rate_limit}, Pleroma.Web.Plugs.RateLimiter.Supervisor}, {{:pleroma, :streamer}, Pleroma.Web.Streamer.registry()}, diff --git a/lib/pleroma/application/start_up_dependencies.ex b/lib/pleroma/application/start_up_dependencies.ex index 81468d5d3..96ebeec09 100644 --- a/lib/pleroma/application/start_up_dependencies.ex +++ b/lib/pleroma/application/start_up_dependencies.ex @@ -178,10 +178,7 @@ defmodule Pleroma.Application.StartUpDependencies do defp maybe_add_chat_child(children) do if Config.get([:chat, :enabled]) do - [ - Pleroma.Web.ChatChannel.ChatChannelState, - {Phoenix.PubSub, [name: Pleroma.PubSub, adapter: Phoenix.PubSub.PG2]} | children - ] + [Pleroma.Application.ChatSupervisor | children] else children end