logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: a5e11ad1101dc86309152666b855e1c065a6eabc
parent 6e4b5edc257aa7555dd7c82d2884e0beac0c60ac
Author: Mark Felder <feld@feld.me>
Date:   Fri, 27 Jun 2025 17:24:02 -0700

Custom pruning is not actually needed because an old job cannot exist in the table due to our use of [replace: true] when retrying jobs or walking it through the different phases

Diffstat:

Mconfig/config.exs5++---
Dlib/pleroma/workers/cron/reachability_pruner.ex26--------------------------
2 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/config/config.exs b/config/config.exs @@ -599,12 +599,11 @@ config :pleroma, Oban, search_indexing: [limit: 10, paused: true], slow: 5 ], - plugins: [{Oban.Plugins.Pruner, max_age: 900, exclude: [Pleroma.Workers.ReachabilityWorker]}], + plugins: [{Oban.Plugins.Pruner, max_age: 900}], crontab: [ {"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker}, {"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker}, - {"*/10 * * * *", Pleroma.Workers.Cron.AppCleanupWorker}, - {"0 2 * * *", Pleroma.Workers.Cron.ReachabilityPruner} + {"*/10 * * * *", Pleroma.Workers.Cron.AppCleanupWorker} ] config :pleroma, Pleroma.Formatter, diff --git a/lib/pleroma/workers/cron/reachability_pruner.ex b/lib/pleroma/workers/cron/reachability_pruner.ex @@ -1,26 +0,0 @@ -defmodule Pleroma.Workers.Cron.ReachabilityPruner do - use Oban.Worker, queue: :background, max_attempts: 1 - - import Ecto.Query - require Logger - - @reachability_worker "Elixir.Pleroma.Workers.ReachabilityWorker" - @prune_days 2 - - @impl true - def perform(_job) do - cutoff = DateTime.utc_now() |> DateTime.add(-@prune_days * 24 * 60 * 60, :second) - - {count, _} = - from(j in Oban.Job, - where: j.worker == @reachability_worker and j.inserted_at < ^cutoff - ) - |> Pleroma.Repo.delete_all() - - if count > 0 do - Logger.debug(fn -> "Pruned #{count} old ReachabilityWorker jobs." end) - end - - :ok - end -end