fix(stats): leave our own host out of the peers
Favicon lookups for local accounts can add our own host to instances. Also skip userinfo and IPv6 literals in the backfill migration.
This commit is contained in:
parent
e8f238359f
commit
958166589e
5 changed files with 15 additions and 4 deletions
|
|
@ -67,7 +67,10 @@ defmodule Pleroma.Stats do
|
|||
def calculate_stat_data do
|
||||
# Hosts are unique in instances, and remote users add theirs. Scanning
|
||||
# all remote users for their domains was one of the costliest queries.
|
||||
peers = Repo.all(from(i in Instance, select: i.host))
|
||||
# Favicon lookups for local accounts can add our own host, so skip it.
|
||||
peers =
|
||||
from(i in Instance, where: i.host != ^local_host(), select: i.host)
|
||||
|> Repo.all()
|
||||
|
||||
domain_count = Enum.count(peers)
|
||||
|
||||
|
|
@ -93,6 +96,9 @@ defmodule Pleroma.Stats do
|
|||
}
|
||||
end
|
||||
|
||||
# Read from the config: this also runs before the endpoint has started.
|
||||
defp local_host, do: Pleroma.Config.get([Pleroma.Web.Endpoint, :url, :host])
|
||||
|
||||
@spec get_status_visibility_count(String.t() | nil) :: map()
|
||||
def get_status_visibility_count(instance \\ nil) do
|
||||
if is_nil(instance) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue