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:
Lain Soykaf 2026-10-27 20:53:56 +04:00
commit 958166589e
No known key found for this signature in database
5 changed files with 15 additions and 4 deletions

View file

@ -19,12 +19,14 @@ defmodule Pleroma.Repo.Migrations.BackfillInstancesFromUsersTest do
insert(:user, local: false, ap_id: "https://new.example/users/a")
insert(:user, local: false, ap_id: "https://new.example/users/b")
insert(:user, local: false, ap_id: "https://ported.example:8443/users/c")
insert(:user, local: false, ap_id: "https://user@userinfo.example/users/d")
insert(:user, local: false, ap_id: "https://[2001:db8::1]/users/e")
insert(:user, local: true)
migration.up()
hosts = Instance |> Repo.all() |> Enum.map(& &1.host) |> Enum.sort()
assert hosts == ["known.example", "new.example", "ported.example"]
assert hosts == ["known.example", "new.example", "ported.example", "userinfo.example"]
assert %{unreachable_since: ^unreachable_since} = Repo.get_by(Instance, host: "known.example")
end

View file

@ -86,6 +86,8 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
# Peers come from the instances table, which remote users add to.
insert(:instance, host: "peer1.com")
insert(:instance, host: "peer2.com")
# Favicon lookups for local accounts can add our own host.
insert(:instance, host: Pleroma.Web.Endpoint.host())
Pleroma.Stats.force_update()