diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-07-17 16:12:35 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-09-24 10:12:04 +0300 |
commit | 10f74f233f15899f70f3ca2f4a6a21ec460669af (patch) | |
tree | 8b38454dc2d812ea9963ed95d43d503ff7940c37 | |
parent | ce72bca3a662779ba7bb9b06b9ccb4f0a72c7705 (diff) |
restart_child if child wasn't started yet
-rw-r--r-- | lib/pleroma/application/dynamic_supervisor.ex | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/pleroma/application/dynamic_supervisor.ex b/lib/pleroma/application/dynamic_supervisor.ex index 54af19e63..a488abffd 100644 --- a/lib/pleroma/application/dynamic_supervisor.ex +++ b/lib/pleroma/application/dynamic_supervisor.ex @@ -106,10 +106,10 @@ defmodule Pleroma.Application.DynamicSupervisor do {{:pleroma, :pools}, Pleroma.Application.GunSupervisor}, {{:pleroma, :connections_pool}, Pleroma.Application.GunSupervisor}, {{:pleroma, :hackney_pools}, Pleroma.Application.HackneySupervisor}, + {{:pleroma, :gopher}, Pleroma.Gopher.Server}, {{:pleroma, Pleroma.Captcha, [:seconds_valid]}, Pleroma.Web.Endpoint}, {{:pleroma, Pleroma.Upload, [:proxy_remote]}, adapter_module}, {{:pleroma, :instance, [:upload_limit]}, Pleroma.Web.Endpoint}, - {{:pleroma, :gopher, [:enabled]}, Pleroma.Gopher.Server}, {{:pleroma, :fed_sockets, [:enabled]}, Pleroma.Web.Endpoint} ] end @@ -152,8 +152,19 @@ defmodule Pleroma.Application.DynamicSupervisor do end defp restart_child(path) do - pid = Pleroma.Application.Agent.pid(path) + path + |> Pleroma.Application.Agent.pid() + |> restart_child(path) + end + + defp restart_child(nil, path) do + # child wasn't started yet + with {_, module} <- find_mapping(path) do + start_dynamic_child(module) + end + end + defp restart_child(pid, path) when is_pid(pid) do # main module can have multiple keys # first we search for main module with {_, module} <- find_mapping(path), |