Merge branch 'gun/snooze' into 'develop'
Gun: Publisher job behavior improvement See merge request pleroma/pleroma!4202
This commit is contained in:
commit
b389b85d77
2 changed files with 8 additions and 1 deletions
1
changelog.d/oban_gun_snooze.change
Normal file
1
changelog.d/oban_gun_snooze.change
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Publisher behavior improvement when snoozing Oban jobs due to Gun connection pool contention.
|
|
@ -143,9 +143,13 @@ def publish_one(%{inbox: inbox, activity_id: activity_id} = params) do
|
||||||
_ -> {:error, e}
|
_ -> {:error, e}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
{:error, {:already_started, _}} ->
|
||||||
|
Logger.debug("Publisher snoozing worker job due worker :already_started race condition")
|
||||||
|
connection_pool_snooze()
|
||||||
|
|
||||||
{:error, :pool_full} ->
|
{:error, :pool_full} ->
|
||||||
Logger.debug("Publisher snoozing worker job due to full connection pool")
|
Logger.debug("Publisher snoozing worker job due to full connection pool")
|
||||||
{:snooze, 30}
|
connection_pool_snooze()
|
||||||
|
|
||||||
e ->
|
e ->
|
||||||
unless params[:unreachable_since], do: Instances.set_unreachable(inbox)
|
unless params[:unreachable_since], do: Instances.set_unreachable(inbox)
|
||||||
|
@ -155,6 +159,8 @@ def publish_one(%{inbox: inbox, activity_id: activity_id} = params) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp connection_pool_snooze, do: {:snooze, 3}
|
||||||
|
|
||||||
defp signature_host(%URI{port: port, scheme: scheme, host: host}) do
|
defp signature_host(%URI{port: port, scheme: scheme, host: host}) do
|
||||||
if port == URI.default_port(scheme) do
|
if port == URI.default_port(scheme) do
|
||||||
host
|
host
|
||||||
|
|
Loading…
Reference in a new issue