From: Roger Braun Date: Wed, 8 Nov 2017 16:25:18 +0000 (+0100) Subject: Look through whole db for user timelines. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=d2430d50070c290552fdeab468f2c537d7438c97;p=akkoma Look through whole db for user timelines. They already have an index that's good enough. --- diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 4f7be4293..e7d4c48bd 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -157,6 +157,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do defp restrict_favorited_by(query, _), do: query # Only search through last 100_000 activities by default + defp restrict_recent(query, %{"whole_db" => true}), do: query defp restrict_recent(query, _) do since = (Repo.aggregate(Activity, :max, :id) || 0) - 100_000 diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 96cf39f1a..feaf9a900 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -122,6 +122,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do params = params |> Map.put("type", ["Create", "Announce"]) |> Map.put("actor_id", ap_id) + |> Map.put("whole_db", true) activities = ActivityPub.fetch_activities([], params) |> Enum.reverse diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex index 2604b54dc..125eb8a1e 100644 --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@ -68,7 +68,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do def user_timeline(%{assigns: %{user: user}} = conn, params) do case TwitterAPI.get_user(user, params) do {:ok, target_user} -> - params = Map.merge(params, %{"actor_id" => target_user.ap_id}) + params = Map.merge(params, %{"actor_id" => target_user.ap_id, "whole_db" => true}) statuses = TwitterAPI.fetch_user_statuses(user, params) conn |> json_reply(200, statuses |> Poison.encode!)