Refresh profiles in a background task

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-05-12 18:18:20 +02:00
parent 8c53ea442f
commit 4100b2f962
6 changed files with 40 additions and 15 deletions

View File

@@ -5,6 +5,7 @@ defmodule Mobilizon.Service.Workers.Background do
alias Mobilizon.Actors
alias Mobilizon.Actors.Actor
alias Mobilizon.Federation.ActivityPub.Refresher
use Mobilizon.Service.Workers.Helper, queue: "background"
@@ -22,4 +23,10 @@ defmodule Mobilizon.Service.Workers.Background do
Actors.actor_key_rotation(actor)
end
end
def perform(%Job{args: %{"op" => "refresh_profile", "actor_id" => actor_id}}) do
with %Actor{} = actor <- Actors.get_actor(actor_id) do
Refresher.refresh_profile(actor)
end
end
end