start chat deps through supervisor

This commit is contained in:
Alexander Strizhakov 2021-03-14 18:10:08 +03:00
parent 90a2b50673
commit 7e10166065
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381
3 changed files with 21 additions and 5 deletions

View File

@ -0,0 +1,19 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# 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

View File

@ -8,7 +8,7 @@ defmodule Pleroma.Application.ConfigDependentDeps do
require Logger require Logger
@config_path_mods_relation [ @config_path_mods_relation [
{{:pleroma, :chat}, Pleroma.Web.ChatChannel.ChatChannelState}, {{:pleroma, :chat}, Pleroma.Application.ChatSupervisor},
{{:pleroma, Oban}, Oban}, {{:pleroma, Oban}, Oban},
{{:pleroma, :rate_limit}, Pleroma.Web.Plugs.RateLimiter.Supervisor}, {{:pleroma, :rate_limit}, Pleroma.Web.Plugs.RateLimiter.Supervisor},
{{:pleroma, :streamer}, Pleroma.Web.Streamer.registry()}, {{:pleroma, :streamer}, Pleroma.Web.Streamer.registry()},

View File

@ -178,10 +178,7 @@ defmodule Pleroma.Application.StartUpDependencies do
defp maybe_add_chat_child(children) do defp maybe_add_chat_child(children) do
if Config.get([:chat, :enabled]) do if Config.get([:chat, :enabled]) do
[ [Pleroma.Application.ChatSupervisor | children]
Pleroma.Web.ChatChannel.ChatChannelState,
{Phoenix.PubSub, [name: Pleroma.PubSub, adapter: Phoenix.PubSub.PG2]} | children
]
else else
children children
end end