X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=benchmarks%2Fload_testing%2Ffetcher.ex;h=a45a71d4a4b706fc80e6fd0bcc2a5e0c0b6a482d;hb=29a98b86b7056540ed4102a83dfe6a7e809c2519;hp=e378c51e7f55db8bcd64f4b28e27f8c098cf34a6;hpb=dcb23a85b6b05db4958b82ad14083cfa8577f477;p=akkoma diff --git a/benchmarks/load_testing/fetcher.ex b/benchmarks/load_testing/fetcher.ex index e378c51e7..a45a71d4a 100644 --- a/benchmarks/load_testing/fetcher.ex +++ b/benchmarks/load_testing/fetcher.ex @@ -39,10 +39,12 @@ defmodule Pleroma.LoadTesting.Fetcher do "muting_user" => user } + following = User.following(user) + Benchee.run(%{ "User home timeline" => fn -> Pleroma.Web.ActivityPub.ActivityPub.fetch_activities( - [user.ap_id | user.following], + following, home_timeline_params ) end, @@ -60,7 +62,7 @@ defmodule Pleroma.LoadTesting.Fetcher do home_activities = Pleroma.Web.ActivityPub.ActivityPub.fetch_activities( - [user.ap_id | user.following], + following, home_timeline_params ) @@ -93,7 +95,36 @@ defmodule Pleroma.LoadTesting.Fetcher do for: user, as: :activity }) - end + end, + "Rendering favorites timeline" => fn -> + conn = Phoenix.ConnTest.build_conn(:get, "http://localhost:4001/api/v1/favourites", nil) + Pleroma.Web.MastodonAPI.StatusController.favourites( + %Plug.Conn{conn | + 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