wait in mix task while pleroma is rebooted
This commit is contained in:
parent
f259b1adab
commit
474ef512df
3 changed files with 51 additions and 14 deletions
|
|
@ -12,6 +12,19 @@ defmodule Mix.Pleroma do
|
|||
end
|
||||
|
||||
{:ok, _} = Application.ensure_all_started(:pleroma)
|
||||
|
||||
if Pleroma.Config.get(:env) not in [:test, :benchmark] do
|
||||
pleroma_rebooted?()
|
||||
end
|
||||
end
|
||||
|
||||
defp pleroma_rebooted? do
|
||||
if Restarter.Pleroma.rebooted?() do
|
||||
:ok
|
||||
else
|
||||
Process.sleep(10)
|
||||
pleroma_rebooted?()
|
||||
end
|
||||
end
|
||||
|
||||
def load_pleroma do
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ defmodule Pleroma.Config.TransferTask do
|
|||
|
||||
@spec load_and_update_env([ConfigDB.t()]) :: :ok | false
|
||||
def load_and_update_env(deleted \\ [], restart_pleroma? \\ true) do
|
||||
with true <- Pleroma.Config.get(:configurable_from_database),
|
||||
with {:configurable, true} <-
|
||||
{:configurable, Pleroma.Config.get(:configurable_from_database)},
|
||||
true <- Ecto.Adapters.SQL.table_exists?(Repo, "config"),
|
||||
started_applications <- Application.started_applications() do
|
||||
# We need to restart applications for loaded settings take effect
|
||||
|
|
@ -65,12 +66,15 @@ defmodule Pleroma.Config.TransferTask do
|
|||
if :pleroma in applications do
|
||||
List.delete(applications, :pleroma) ++ [:pleroma]
|
||||
else
|
||||
Restarter.Pleroma.rebooted()
|
||||
applications
|
||||
end
|
||||
|
||||
Enum.each(applications, &restart(started_applications, &1, Pleroma.Config.get(:env)))
|
||||
|
||||
:ok
|
||||
else
|
||||
{:configurable, false} -> Restarter.Pleroma.rebooted()
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue