Skip to content

Commit

Permalink
Start ExSync manually to ensure it's started if (and only if) Relive
Browse files Browse the repository at this point in the history
  • Loading branch information
badlop committed Aug 20, 2024
1 parent 53d76dd commit 9f105e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ defmodule Ejabberd.MixProject do
{Mix.env() == :translations,
{:ejabberd_po, git: "https://github.com/processone/ejabberd-po.git"}},
{Mix.env() == :dev,
{:exsync, "~> 0.2"}},
{:exsync, "~> 0.2", optional: true, runtime: false}},
{config(:redis), {:eredis, "~> 1.2.0"}},
{config(:sip), {:esip, "~> 1.0"}},
{config(:zlib), {:ezlib, "~> 1.0"}},
Expand All @@ -208,9 +208,9 @@ defmodule Ejabberd.MixProject do
dep
end


defp cond_apps do
for {:true, app} <- [{config(:stun), :stun},
{Map.has_key?(System.get_env(), "RELIVE"), :exsync},
{if_version_below(~c"27", true), :jiffy},
{config(:tools), :observer}], do:
app
Expand Down
8 changes: 8 additions & 0 deletions src/ejabberd_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ start(normal, _Args) ->
ejabberd_hooks:run(ejabberd_started, []),
ejabberd:check_apps(),
ejabberd_systemd:ready(),
maybe_start_exsync(),
{T2, _} = statistics(wall_clock),
?INFO_MSG("ejabberd ~ts is started in the node ~p in ~.2fs",
[ejabberd_option:version(),
Expand Down Expand Up @@ -198,8 +199,15 @@ start_elixir_application() ->
ok -> ok;
{error, _Msg} -> ?ERROR_MSG("Elixir application not started.", [])
end.

maybe_start_exsync() ->
case os:getenv("RELIVE") of
"true" -> 'Elixir.ExSync.Application':start();
_ -> ok
end.
-else.
setup_if_elixir_conf_used() -> ok.
register_elixir_config_hooks() -> ok.
start_elixir_application() -> ok.
maybe_start_exsync() -> ok.
-endif.

0 comments on commit 9f105e1

Please sign in to comment.