This commit is contained in:
Maksim Pechnikov 2019-11-22 14:17:12 +03:00
parent 1fcd579b6d
commit 1d6970baf1
1 changed files with 27 additions and 9 deletions

View File

@ -57,9 +57,6 @@ def query_timelines(user) do
Pleroma.Web.ActivityPub.ActivityPub.fetch_public_activities( Pleroma.Web.ActivityPub.ActivityPub.fetch_public_activities(
mastodon_federated_timeline_params mastodon_federated_timeline_params
) )
end,
"User favourites timeline" => fn ->
Pleroma.Web.ActivityPub.ActivityPub.fetch_favourites(user)
end end
}) })
@ -77,8 +74,6 @@ def query_timelines(user) do
mastodon_federated_timeline_params mastodon_federated_timeline_params
) )
user_favourites = Pleroma.Web.ActivityPub.ActivityPub.fetch_favourites(user)
Benchee.run(%{ Benchee.run(%{
"Rendering home timeline" => fn -> "Rendering home timeline" => fn ->
Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{ Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{
@ -102,10 +97,33 @@ def query_timelines(user) do
}) })
end, end,
"Rendering favorites timeline" => fn -> "Rendering favorites timeline" => fn ->
Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{ conn = Phoenix.ConnTest.build_conn(:get, "http://localhost:4001/api/v1/favourites", nil)
activities: user_favourites, Pleroma.Web.MastodonAPI.StatusController.favourites(
for: user, %Plug.Conn{conn |
as: :activity}) assigns: %{user: user},
query_params: %{"limit" => "0"},
body_params: %{},
cookies: %{},
params: %{},
path_params: %{},
private: %{
Pleroma.Web.Router => {[], %{}},
phoenix_router: Pleroma.Web.Router,
phoenix_action: :favourites,
phoenix_controller: Pleroma.Web.MastodonAPI.StatusController,
phoenix_endpoint: Pleroma.Web.Endpoint,
phoenix_format: "json",
phoenix_layout: {Pleroma.Web.LayoutView, "app.html"},
phoenix_recycled: true,
phoenix_view: Pleroma.Web.MastodonAPI.StatusView,
plug_session: %{"user_id" => user.id},
plug_session_fetch: :done,
plug_session_info: :write,
plug_skip_csrf_protection: true
}
},
%{})
end, end,
}) })
end end