2020-01-23 00:55:07 +01:00
|
|
|
defmodule Mobilizon.Service.Workers.Background do
|
2019-12-03 11:29:51 +01:00
|
|
|
@moduledoc """
|
|
|
|
Worker to build search results
|
|
|
|
"""
|
|
|
|
|
|
|
|
alias Mobilizon.Actors
|
|
|
|
alias Mobilizon.Actors.Actor
|
|
|
|
|
2020-01-23 00:55:07 +01:00
|
|
|
use Mobilizon.Service.Workers.Helper, queue: "background"
|
2019-12-03 11:29:51 +01:00
|
|
|
|
|
|
|
@impl Oban.Worker
|
|
|
|
def perform(%{"op" => "delete_actor", "actor_id" => actor_id}, _job) do
|
|
|
|
with %Actor{} = actor <- Actors.get_actor(actor_id) do
|
|
|
|
Actors.perform(:delete_actor, actor)
|
|
|
|
end
|
|
|
|
end
|
2020-02-14 17:56:36 +01:00
|
|
|
|
|
|
|
def perform(%{"op" => "actor_key_rotation", "actor_id" => actor_id}, _job) do
|
|
|
|
with %Actor{} = actor <- Actors.get_actor(actor_id) do
|
|
|
|
Actors.actor_key_rotation(actor)
|
|
|
|
end
|
|
|
|
end
|
2019-12-03 11:29:51 +01:00
|
|
|
end
|