diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-03-21 20:22:05 +0100 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-03-21 20:22:05 +0100 |
commit | d4cf273f289168c6555624717a4060e0c15b7197 (patch) | |
tree | c6f3c4c55925251308eac005bdd9bfaaef02732a /lib | |
parent | ad303783afc0be046d0bcb4b70b3bce9aabac27f (diff) | |
download | pleroma-d4cf273f289168c6555624717a4060e0c15b7197.tar.gz pleroma-d4cf273f289168c6555624717a4060e0c15b7197.zip |
Add limiting to activity pub fetching.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 0317b4cd5..1f6ee4744 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -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 |