banner_upload_limit: 4_000_000,
registrations_open: true,
federating: true,
+ federation_reachability_timeout_days: 90,
allow_relay: true,
rewrite_policy: Pleroma.Web.ActivityPub.MRF.NoOpPolicy,
public: true,
* `invites_enabled`: Enable user invitations for admins (depends on `registrations_open: false`).
* `account_activation_required`: Require users to confirm their emails before signing in.
* `federating`: Enable federation with other instances
+* `federation_reachability_timeout_days`: Timeout (in days) of each external federation target being unreachable prior to pausing federating to it.
* `allow_relay`: Enable Pleroma’s Relay, which makes it possible to follow a whole instance
* `rewrite_policy`: Message Rewrite Policy, either one or a list. Here are the ones available by default:
* `Pleroma.Web.ActivityPub.MRF.NoOpPolicy`: Doesn’t modify activities (default)
defdelegate set_reachable(url), to: @adapter
defdelegate set_unreachable(url, unreachable_since \\ nil), to: @adapter
- def reachability_time_threshold,
- do: NaiveDateTime.add(NaiveDateTime.utc_now(), -30 * 24 * 3600, :second)
+ def reachability_datetime_threshold do
+ federation_reachability_timeout_days =
+ Pleroma.Config.get(:instance)[:federation_reachability_timeout_days] || 90
+
+ if federation_reachability_timeout_days > 0 do
+ NaiveDateTime.add(
+ NaiveDateTime.utc_now(),
+ -federation_reachability_timeout_days * 24 * 3600,
+ :second
+ )
+ else
+ ~N[0000-01-01 00:00:00]
+ end
+ end
def host(url_or_host) when is_binary(url_or_host) do
if url_or_host =~ ~r/^http/i do
Repo.all(
from(i in Instance,
where:
- i.host in ^hosts and i.unreachable_since <= ^Instances.reachability_time_threshold(),
+ i.host in ^hosts and
+ i.unreachable_since <= ^Instances.reachability_datetime_threshold(),
select: i.host
)
)
!Repo.one(
from(i in Instance,
where:
- i.host == ^host(url) and i.unreachable_since <= ^Instances.reachability_time_threshold(),
+ i.host == ^host(url) and
+ i.unreachable_since <= ^Instances.reachability_datetime_threshold(),
select: true
)
)