Merge branch 'benchmark-finishing' into 'develop'

Benchmark finishing

Closes #755

See merge request pleroma/pleroma!1848
This commit is contained in:
lain 2019-10-16 11:54:49 +00:00
commit 6977cddff9
10 changed files with 853 additions and 4 deletions

View file

@ -437,7 +437,9 @@ defmodule Pleroma.User do
{:error, "Could not follow user: #{followed.nickname} blocked you."}
true ->
if !followed.local && follower.local && !ap_enabled?(followed) do
benchmark? = Pleroma.Config.get([:env]) == :benchmark
if !followed.local && follower.local && !ap_enabled?(followed) && !benchmark? do
Websub.subscribe(follower, followed)
end

View file

@ -225,6 +225,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
# only accept false as false value
local = !(params[:local] == false)
published = params[:published]
quick_insert? = Pleroma.Config.get([:env]) == :benchmark
with create_data <-
make_create_data(
@ -235,12 +236,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
{:fake, false, activity} <- {:fake, fake, activity},
_ <- increase_replies_count_if_reply(create_data),
_ <- increase_poll_votes_if_vote(create_data),
{:quick_insert, false, activity} <- {:quick_insert, quick_insert?, activity},
# Changing note count prior to enqueuing federation task in order to avoid
# race conditions on updating user.info
{:ok, _actor} <- increase_note_count_if_public(actor, activity),
:ok <- maybe_federate(activity) do
{:ok, activity}
else
{:quick_insert, true, activity} ->
{:ok, activity}
{:fake, true, activity} ->
{:ok, activity}

View file

@ -49,7 +49,7 @@ defmodule Pleroma.Web.Streamer do
end
end
defp handle_should_send(_) do
true
end
defp handle_should_send(:benchmark), do: false
defp handle_should_send(_), do: true
end