refactor(activitypub): log instance actor details before it's created

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-12-22 16:16:21 +01:00
parent da3b074619
commit 6d2f08f3c1
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -48,16 +48,17 @@ defmodule Mobilizon.Service.Workers.RefreshInstances do
end end
with instance_metadata <- fetch_instance_metadata(domain), with instance_metadata <- fetch_instance_metadata(domain),
:ok <- Logger.debug("Ready to save instance actor details"), args <- %{
{:ok, %InstanceActor{}} <-
Instances.create_instance_actor(%{
domain: domain, domain: domain,
actor_id: actor_id, actor_id: actor_id,
instance_name: get_in(instance_metadata, ["metadata", "nodeName"]), instance_name: get_in(instance_metadata, ["metadata", "nodeName"]),
instance_description: get_in(instance_metadata, ["metadata", "nodeDescription"]), instance_description: get_in(instance_metadata, ["metadata", "nodeDescription"]),
software: get_in(instance_metadata, ["software", "name"]), software: get_in(instance_metadata, ["software", "name"]),
software_version: get_in(instance_metadata, ["software", "version"]) software_version: get_in(instance_metadata, ["software", "version"])
}) do },
:ok <- Logger.debug("Ready to save instance actor details #{inspect(args)}"),
{:ok, %InstanceActor{}} <-
Instances.create_instance_actor(args) do
Logger.info("Saved instance actor details for domain #{host}") Logger.info("Saved instance actor details for domain #{host}")
else else
err -> err ->