Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jeff
pleroma
Commits
656ed7c8
Commit
656ed7c8
authored
6 years ago
by
Ivan Tashkinov
Browse files
Options
Downloads
Patches
Plain Diff
[#534] Configurable outgoing federation reachability timeout.
parent
3e9399ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
config/config.exs
+1
-0
1 addition, 0 deletions
config/config.exs
docs/config.md
+1
-0
1 addition, 0 deletions
docs/config.md
lib/pleroma/instances.ex
+14
-2
14 additions, 2 deletions
lib/pleroma/instances.ex
lib/pleroma/instances/instance.ex
+4
-2
4 additions, 2 deletions
lib/pleroma/instances/instance.ex
with
20 additions
and
4 deletions
config/config.exs
+
1
−
0
View file @
656ed7c8
...
...
@@ -125,6 +125,7 @@ config :pleroma, :instance,
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
,
...
...
This diff is collapsed.
Click to expand it.
docs/config.md
+
1
−
0
View file @
656ed7c8
...
...
@@ -72,6 +72,7 @@ config :pleroma, Pleroma.Mailer,
*
`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)
...
...
This diff is collapsed.
Click to expand it.
lib/pleroma/instances.ex
+
14
−
2
View file @
656ed7c8
...
...
@@ -8,8 +8,20 @@ defmodule Pleroma.Instances do
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
...
...
This diff is collapsed.
Click to expand it.
lib/pleroma/instances/instance.ex
+
4
−
2
View file @
656ed7c8
...
...
@@ -39,7 +39,8 @@ defmodule Pleroma.Instances.Instance 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
)
)
...
...
@@ -51,7 +52,8 @@ defmodule Pleroma.Instances.Instance do
!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
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment