Merge remote-tracking branch 'origin/develop' into oban/backup

This commit is contained in:
Mark Felder 2024-07-25 14:43:40 -04:00
commit 775f45cfe2
12 changed files with 64 additions and 28 deletions

View file

@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Workers.RichMediaWorker do
alias Pleroma.Config
alias Pleroma.Web.RichMedia.Backfill
alias Pleroma.Web.RichMedia.Card
@ -19,18 +20,21 @@ defmodule Pleroma.Workers.RichMediaWorker do
:ok
{:error, type}
when type in [:invalid_metadata, :body_too_large, :content_type, :validate] ->
when type in [:invalid_metadata, :body_too_large, :content_type, :validate, :get, :head] ->
{:cancel, type}
{:error, type}
when type in [:get, :head] ->
{:error, type}
error ->
{:error, error}
end
end
# There is timeout value enforced by Tesla.Middleware.Timeout
# which can be found in the RichMedia.Helpers module to allow us to detect
# a slow/infinite data stream and insert a negative cache entry for the URL
# We pad it by 2 seconds to be certain a slow connection is detected and we
# can inject a negative cache entry for the URL
@impl Oban.Worker
def timeout(_job), do: :timer.seconds(5)
def timeout(_job) do
Config.get!([:rich_media, :timeout]) + :timer.seconds(2)
end
end