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