Rename RichMediaExpirationWorker to RichMediaWorker

This commit is contained in:
Mark Felder 2024-06-19 21:25:24 -04:00
parent 9a4cdde5c9
commit 4dfa50f256
4 changed files with 12 additions and 6 deletions

View File

@ -6,7 +6,7 @@ defmodule Pleroma.Web.RichMedia.Backfill do
alias Pleroma.Web.RichMedia.Card alias Pleroma.Web.RichMedia.Card
alias Pleroma.Web.RichMedia.Parser alias Pleroma.Web.RichMedia.Parser
alias Pleroma.Web.RichMedia.Parser.TTL alias Pleroma.Web.RichMedia.Parser.TTL
alias Pleroma.Workers.RichMediaExpirationWorker alias Pleroma.Workers.RichMediaWorker
require Logger require Logger
@ -72,7 +72,7 @@ defmodule Pleroma.Web.RichMedia.Backfill do
{:ok, ttl} when is_number(ttl) -> {:ok, ttl} when is_number(ttl) ->
timestamp = DateTime.from_unix!(ttl) timestamp = DateTime.from_unix!(ttl)
RichMediaExpirationWorker.new(%{"url" => url}, scheduled_at: timestamp) RichMediaWorker.new(%{"op" => "expire", "url" => url}, scheduled_at: timestamp)
|> Oban.insert() |> Oban.insert()
_ -> _ ->

View File

@ -2,14 +2,14 @@
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Workers.RichMediaExpirationWorker do defmodule Pleroma.Workers.RichMediaWorker do
alias Pleroma.Web.RichMedia.Card alias Pleroma.Web.RichMedia.Card
use Oban.Worker, use Oban.Worker,
queue: :background queue: :background
@impl Oban.Worker @impl Oban.Worker
def perform(%Job{args: %{"url" => url} = _args}) do def perform(%Job{args: %{"op" => "expire", "url" => url} = _args}) do
Card.delete(url) Card.delete(url)
end end
end end

View File

@ -74,7 +74,10 @@ defmodule Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrlTest do
Card.get_or_backfill_by_url(url) Card.get_or_backfill_by_url(url)
assert_enqueued(worker: Pleroma.Workers.RichMediaExpirationWorker, args: %{"url" => url}) assert_enqueued(
worker: Pleroma.Workers.RichMediaWorker,
args: %{"op" => "expire", "url" => url}
)
[%Oban.Job{scheduled_at: scheduled_at}] = all_enqueued() [%Oban.Job{scheduled_at: scheduled_at}] = all_enqueued()

View File

@ -36,6 +36,9 @@ defmodule Pleroma.Web.RichMedia.Parser.TTL.OpengraphTest do
Card.get_or_backfill_by_url(url) Card.get_or_backfill_by_url(url)
assert_enqueued(worker: Pleroma.Workers.RichMediaExpirationWorker, args: %{"url" => url}) assert_enqueued(
worker: Pleroma.Workers.RichMediaWorker,
args: %{"op" => "expire", "url" => url}
)
end end
end end