Add limiting to activity pub fetching.
This commit is contained in:
parent
ad303783af
commit
d4cf273f28
3 changed files with 39 additions and 16 deletions
|
|
@ -9,8 +9,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
|
||||
def fetch_public_activities do
|
||||
query = from activity in Activity,
|
||||
where: fragment(~s(? @> '{"to": ["https://www.w3.org/ns/activitystreams#Public"]}'), activity.data)
|
||||
where: fragment(~s(? @> '{"to": ["https://www.w3.org/ns/activitystreams#Public"]}'), activity.data),
|
||||
limit: 20,
|
||||
order_by: [desc: :inserted_at]
|
||||
|
||||
Repo.all(query)
|
||||
|> Enum.reverse
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue