debianize-mobilizon/lib/service/workers/clean_suspended_actors.ex
Thomas Citharel 1893d9f55b
Various refactoring and typespec improvements
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2021-09-26 17:52:24 +02:00

19 lines
481 B
Elixir

defmodule Mobilizon.Service.Workers.CleanSuspendedActors do
@moduledoc """
Worker to clean unattached media
"""
use Oban.Worker, queue: "background"
alias Mobilizon.Actors
alias Mobilizon.Service.ActorSuspension
@suspention_days 30
@impl Oban.Worker
def perform(%Job{}) do
[suspension: @suspention_days]
|> Actors.list_suspended_actors_to_purge()
|> Enum.each(&ActorSuspension.suspend_actor(&1, reserve_username: true, suspension: true))
end
end