akkoma/lib/pleroma/workers/cron/database_prune_worker.ex
floatingghost db60640c5b Fixing up deletes a bit (#327)
Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
Reviewed-on: AkkomaGang/akkoma#327
2022-12-01 15:00:53 +00:00

32 lines
811 B
Elixir

defmodule Pleroma.Workers.Cron.PruneDatabaseWorker do
@moduledoc """
The worker to prune old data from the database.
"""
require Logger
use Oban.Worker, queue: "database_prune"
alias Pleroma.Activity.Pruner, as: ActivityPruner
alias Pleroma.Object.Pruner, as: ObjectPruner
@impl Oban.Worker
def perform(_job) do
Logger.info("Pruning old data from the database")
Logger.info("Pruning old deletes")
ActivityPruner.prune_deletes()
Logger.info("Pruning old undos")
ActivityPruner.prune_undos()
Logger.info("Pruning old removes")
ActivityPruner.prune_removes()
Logger.info("Pruning old tombstone delivery entries")
ObjectPruner.prune_tombstoned_deliveries()
Logger.info("Pruning old tombstones")
ObjectPruner.prune_tombstones()
:ok
end
end