mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-14 14:29:59 +00:00
1a7839eaf2
Once processed they serve no purpose anymore afaict. Therefor, lets prune them like other transient activities to not unnecessarily bloat the table.
39 lines
983 B
Elixir
39 lines
983 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 follow requests")
|
|
ActivityPruner.prune_stale_follow_requests()
|
|
|
|
Logger.info("Pruning old undos")
|
|
ActivityPruner.prune_undos()
|
|
|
|
Logger.info("Pruning old updates")
|
|
ActivityPruner.prune_updates()
|
|
|
|
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
|