mirror of
https://git.youjo.love/youjo/youjo-be.git
synced 2024-11-20 05:49:54 +01:00
Benchmarks: fix user timeline and tags benchmarks
This commit is contained in:
parent
eb7bbe3fc8
commit
185d70ed3d
2 changed files with 15 additions and 14 deletions
|
@ -99,15 +99,16 @@ defmodule Mix.Tasks.Pleroma.Benchmarks.Tags do
|
||||||
|> Enum.map(&String.downcase(&1))
|
|> Enum.map(&String.downcase(&1))
|
||||||
|
|
||||||
_activities =
|
_activities =
|
||||||
params
|
%{
|
||||||
|> Map.put(:type, "Create")
|
type: "Create",
|
||||||
|> Map.put(:local_only, local_only)
|
local_only: local_only,
|
||||||
|> Map.put(:blocking_user, user)
|
blocking_user: user,
|
||||||
|> Map.put(:muting_user, user)
|
muting_user: user,
|
||||||
|> Map.put(:user, user)
|
user: user,
|
||||||
|> Map.put(:tag, tags)
|
tag: tags,
|
||||||
|> Map.put(:tag_all, tag_all)
|
tag_all: tag_all,
|
||||||
|> Map.put(:tag_reject, tag_reject)
|
tag_reject: tag_reject,
|
||||||
|
}
|
||||||
|> Pleroma.Web.ActivityPub.ActivityPub.fetch_public_activities()
|
|> Pleroma.Web.ActivityPub.ActivityPub.fetch_public_activities()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,14 +17,14 @@ defmodule Mix.Tasks.Pleroma.Benchmarks.Timelines do
|
||||||
# Let the user make 100 posts
|
# Let the user make 100 posts
|
||||||
|
|
||||||
1..100
|
1..100
|
||||||
|> Enum.each(fn i -> CommonAPI.post(user, %{"status" => to_string(i)}) end)
|
|> Enum.each(fn i -> CommonAPI.post(user, %{status: to_string(i)}) end)
|
||||||
|
|
||||||
# Let 10 random users post
|
# Let 10 random users post
|
||||||
posts =
|
posts =
|
||||||
users
|
users
|
||||||
|> Enum.take_random(10)
|
|> Enum.take_random(10)
|
||||||
|> Enum.map(fn {:ok, random_user} ->
|
|> Enum.map(fn {:ok, random_user} ->
|
||||||
{:ok, activity} = CommonAPI.post(random_user, %{"status" => "."})
|
{:ok, activity} = CommonAPI.post(random_user, %{status: "."})
|
||||||
activity
|
activity
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ defmodule Mix.Tasks.Pleroma.Benchmarks.Timelines do
|
||||||
|> Conn.assign(:user, reading_user)
|
|> Conn.assign(:user, reading_user)
|
||||||
|> Conn.assign(:skip_link_headers, true)
|
|> Conn.assign(:skip_link_headers, true)
|
||||||
|
|
||||||
Pleroma.Web.MastodonAPI.AccountController.statuses(conn, %{"id" => user.id})
|
Pleroma.Web.MastodonAPI.AccountController.statuses(conn, %{id: user.id})
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
inputs: %{"user" => user, "no user" => nil},
|
inputs: %{"user" => user, "no user" => nil},
|
||||||
|
@ -50,7 +50,7 @@ defmodule Mix.Tasks.Pleroma.Benchmarks.Timelines do
|
||||||
)
|
)
|
||||||
|
|
||||||
users
|
users
|
||||||
|> Enum.each(fn {:ok, follower, user} -> Pleroma.User.follow(follower, user) end)
|
|> Enum.each(fn {:ok, follower} -> Pleroma.User.follow(follower, user) end)
|
||||||
|
|
||||||
Benchee.run(
|
Benchee.run(
|
||||||
%{
|
%{
|
||||||
|
@ -60,7 +60,7 @@ defmodule Mix.Tasks.Pleroma.Benchmarks.Timelines do
|
||||||
|> Conn.assign(:user, reading_user)
|
|> Conn.assign(:user, reading_user)
|
||||||
|> Conn.assign(:skip_link_headers, true)
|
|> Conn.assign(:skip_link_headers, true)
|
||||||
|
|
||||||
Pleroma.Web.MastodonAPI.AccountController.statuses(conn, %{"id" => user.id})
|
Pleroma.Web.MastodonAPI.AccountController.statuses(conn, %{id: user.id})
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
inputs: %{"user" => user, "no user" => nil},
|
inputs: %{"user" => user, "no user" => nil},
|
||||||
|
|
Loading…
Reference in a new issue