[#534] Optimized bulk publish ops to filter on reachability early. Instance refactoring.
This commit is contained in:
parent
8654a591f0
commit
3e9399ec0b
5 changed files with 69 additions and 28 deletions
|
|
@ -3,10 +3,19 @@ defmodule Pleroma.Instances do
|
|||
|
||||
@adapter Pleroma.Instances.Instance
|
||||
|
||||
defdelegate filter_reachable(urls), to: @adapter
|
||||
defdelegate reachable?(url), to: @adapter
|
||||
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 host(url_or_host) when is_binary(url_or_host) do
|
||||
if url_or_host =~ ~r/^http/i do
|
||||
URI.parse(url_or_host).host
|
||||
else
|
||||
url_or_host
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue