mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-22 16:16:34 +00:00
Fix invalid string comparison for OTP versions and replace with config
Old way was wrong for multiple reasons. If we do this as a config value it fixes :slave.start/3 being picked up as a compile warning on OTP26. Also if we want to do any real clustering we'll need something like this to support OTP25 and older.
This commit is contained in:
parent
56618873af
commit
928bda2e43
3 changed files with 14 additions and 9 deletions
0
changelog.d/fix-otp-comparison.skip
Normal file
0
changelog.d/fix-otp-comparison.skip
Normal file
|
@ -153,6 +153,15 @@ config :pleroma, Pleroma.Upload, config_impl: Pleroma.UnstubbedConfigMock
|
|||
config :pleroma, Pleroma.ScheduledActivity, config_impl: Pleroma.UnstubbedConfigMock
|
||||
config :pleroma, Pleroma.Web.RichMedia.Helpers, config_impl: Pleroma.StaticStubbedConfigMock
|
||||
|
||||
peer_module =
|
||||
if String.to_integer(System.otp_release()) >= 25 do
|
||||
:peer
|
||||
else
|
||||
:slave
|
||||
end
|
||||
|
||||
config :pleroma, Pleroma.Cluster, peer_module: peer_module
|
||||
|
||||
if File.exists?("./config/test.secret.exs") do
|
||||
import_config "test.secret.exs"
|
||||
else
|
||||
|
|
|
@ -223,17 +223,13 @@ defmodule Pleroma.Cluster do
|
|||
|> String.to_atom()
|
||||
end
|
||||
|
||||
if System.otp_release() >= "25" do
|
||||
@peer :peer
|
||||
else
|
||||
@peer :slave
|
||||
end
|
||||
|
||||
defp do_start_slave(%{host: host, name: name, args: args} = opts) do
|
||||
if System.otp_release() >= "25" do
|
||||
@peer.start(opts)
|
||||
peer_module = Application.get_env(__MODULE__, :peer_module)
|
||||
|
||||
if peer_module == :peer do
|
||||
peer_module.start(opts)
|
||||
else
|
||||
@peer.start(host, name, args)
|
||||
peer_module.start(host, name, args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue