More efficient queries.
This commit is contained in:
parent
0b5bc62b33
commit
1cd6194dee
@ -242,8 +242,9 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|||||||
fragment(
|
fragment(
|
||||||
"? @> ?",
|
"? @> ?",
|
||||||
activity.data,
|
activity.data,
|
||||||
^%{type: "Follow", actor: follower_id, object: followed_id}
|
^%{type: "Follow", object: followed_id}
|
||||||
),
|
),
|
||||||
|
where: activity.actor == ^follower_id,
|
||||||
order_by: [desc: :id],
|
order_by: [desc: :id],
|
||||||
limit: 1
|
limit: 1
|
||||||
)
|
)
|
||||||
@ -260,7 +261,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|||||||
query =
|
query =
|
||||||
from(
|
from(
|
||||||
activity in Activity,
|
activity in Activity,
|
||||||
where: fragment("(?)->>'actor' = ?", activity.data, ^actor),
|
where: activity.actor == ^actor,
|
||||||
# this is to use the index
|
# this is to use the index
|
||||||
where:
|
where:
|
||||||
fragment(
|
fragment(
|
||||||
|
@ -95,7 +95,8 @@ defmodule Pleroma.Factory do
|
|||||||
}
|
}
|
||||||
|
|
||||||
%Pleroma.Activity{
|
%Pleroma.Activity{
|
||||||
data: data
|
data: data,
|
||||||
|
actor: follower.ap_id
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user