logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: b389b85d7760d9c275b2584e0e99bff4f0265222
parent 8f1866e3ade52a7d4bacf46b4c06bf9468eb1fef
Author: feld <feld@feld.me>
Date:   Fri,  2 Aug 2024 13:49:11 +0000

Merge branch 'gun/snooze' into 'develop'

Gun: Publisher job behavior improvement

See merge request pleroma/pleroma!4202

Diffstat:

Achangelog.d/oban_gun_snooze.change1+
Mlib/pleroma/web/activity_pub/publisher.ex8+++++++-
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/changelog.d/oban_gun_snooze.change b/changelog.d/oban_gun_snooze.change @@ -0,0 +1 @@ +Publisher behavior improvement when snoozing Oban jobs due to Gun connection pool contention. diff --git a/lib/pleroma/web/activity_pub/publisher.ex b/lib/pleroma/web/activity_pub/publisher.ex @@ -143,9 +143,13 @@ defmodule Pleroma.Web.ActivityPub.Publisher do _ -> {:error, e} end + {:error, {:already_started, _}} -> + Logger.debug("Publisher snoozing worker job due worker :already_started race condition") + connection_pool_snooze() + {:error, :pool_full} -> Logger.debug("Publisher snoozing worker job due to full connection pool") - {:snooze, 30} + connection_pool_snooze() e -> unless params[:unreachable_since], do: Instances.set_unreachable(inbox) @@ -155,6 +159,8 @@ defmodule Pleroma.Web.ActivityPub.Publisher do end end + defp connection_pool_snooze, do: {:snooze, 3} + defp signature_host(%URI{port: port, scheme: scheme, host: host}) do if port == URI.default_port(scheme) do host