diff options
author | lain <lain@soykaf.club> | 2018-05-24 12:44:26 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2018-05-24 12:44:26 +0200 |
commit | 1cd6194deeca32a96a31fc43c0ed27daadd65f64 (patch) | |
tree | d4408133a437cf29e680558a8e75689744b4b027 /lib | |
parent | 0b5bc62b33a655488afe73b35945adcbab11300d (diff) | |
download | pleroma-1cd6194deeca32a96a31fc43c0ed27daadd65f64.tar.gz |
More efficient queries.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/utils.ex | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex index 937f032c3..a3feca480 100644 --- a/lib/pleroma/web/activity_pub/utils.ex +++ b/lib/pleroma/web/activity_pub/utils.ex @@ -242,8 +242,9 @@ defmodule Pleroma.Web.ActivityPub.Utils do fragment( "? @> ?", activity.data, - ^%{type: "Follow", actor: follower_id, object: followed_id} + ^%{type: "Follow", object: followed_id} ), + where: activity.actor == ^follower_id, order_by: [desc: :id], limit: 1 ) @@ -260,7 +261,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do query = from( activity in Activity, - where: fragment("(?)->>'actor' = ?", activity.data, ^actor), + where: activity.actor == ^actor, # this is to use the index where: fragment( |