2021-09-24 16:46:42 +02:00
|
|
|
defmodule Mobilizon.Service.Workers.CleanSuspendedActors do
|
2021-09-10 11:36:05 +02:00
|
|
|
@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
|