From 6d2f08f3c184bdee394ea0f34d4d4e805887a74b Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 22 Dec 2023 16:16:21 +0100 Subject: [PATCH] refactor(activitypub): log instance actor details before it's created Signed-off-by: Thomas Citharel --- lib/service/workers/refresh_instances.ex | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/service/workers/refresh_instances.ex b/lib/service/workers/refresh_instances.ex index 5381b1916..85fd530a1 100644 --- a/lib/service/workers/refresh_instances.ex +++ b/lib/service/workers/refresh_instances.ex @@ -48,16 +48,17 @@ defmodule Mobilizon.Service.Workers.RefreshInstances do end with instance_metadata <- fetch_instance_metadata(domain), - :ok <- Logger.debug("Ready to save instance actor details"), + args <- %{ + domain: domain, + actor_id: actor_id, + instance_name: get_in(instance_metadata, ["metadata", "nodeName"]), + instance_description: get_in(instance_metadata, ["metadata", "nodeDescription"]), + software: get_in(instance_metadata, ["software", "name"]), + software_version: get_in(instance_metadata, ["software", "version"]) + }, + :ok <- Logger.debug("Ready to save instance actor details #{inspect(args)}"), {:ok, %InstanceActor{}} <- - Instances.create_instance_actor(%{ - domain: domain, - actor_id: actor_id, - instance_name: get_in(instance_metadata, ["metadata", "nodeName"]), - instance_description: get_in(instance_metadata, ["metadata", "nodeDescription"]), - software: get_in(instance_metadata, ["software", "name"]), - software_version: get_in(instance_metadata, ["software", "version"]) - }) do + Instances.create_instance_actor(args) do Logger.info("Saved instance actor details for domain #{host}") else err ->