2021-09-24 14:46:42 +00:00
|
|
|
defmodule Mobilizon.Service.Workers.CleanSuspendedActors do
|
2021-09-10 09:36:05 +00:00
|
|
|
@moduledoc """
|
2022-04-20 17:15:33 +00:00
|
|
|
Worker to clean suspended actors
|
2021-09-10 09:36:05 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
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
|