diff --git a/lib/sanbase/metric/registry/sync.ex b/lib/sanbase/metric/registry/sync.ex index 140333c45..9ce89da3f 100644 --- a/lib/sanbase/metric/registry/sync.ex +++ b/lib/sanbase/metric/registry/sync.ex @@ -22,8 +22,8 @@ defmodule Sanbase.Metric.Registry.Sync do :ok <- check_initiate_env(), {:ok, content} <- get_sync_content(metric_registry_ids), {:ok, sync} <- store_sync_in_db(content), - :ok <- start_sync(sync), - {:ok, sync} <- Registry.SyncSchema.update_status(sync, "executing") do + {:ok, sync} <- Registry.SyncSchema.update_status(sync, "executing"), + :ok <- start_sync(sync) do {:ok, sync} end end @@ -50,7 +50,7 @@ defmodule Sanbase.Metric.Registry.Sync do with :ok <- check_apply_env(), {:ok, list} when is_list(list) <- Jason.decode(params["content"]), :ok <- do_apply_sync_content(list), - :ok <- send_sync_completed_confirmation(params["confirmation_endpoint"]) do + {:ok, _} <- send_sync_completed_confirmation(params["confirmation_endpoint"]) do :ok end end @@ -106,10 +106,6 @@ defmodule Sanbase.Metric.Registry.Sync do case Req.post(url, json: json) do {:ok, %Req.Response{status: 200}} -> - # The status is set to executing and it will be set to completed - # once the other side responds to the /mark_metric_registry_sync_as_finished - # endpoint - {:ok, _} = Registry.SyncSchema.update_status(sync, "executing") :ok {:ok, %Req.Response{status: status, body: body}} -> diff --git a/lib/sanbase_web/controllers/metric_registry_controller.ex b/lib/sanbase_web/controllers/metric_registry_controller.ex index ae20bf888..7e0ebbfd5 100644 --- a/lib/sanbase_web/controllers/metric_registry_controller.ex +++ b/lib/sanbase_web/controllers/metric_registry_controller.ex @@ -7,7 +7,7 @@ defmodule SanbaseWeb.MetricRegistryController do case Sanbase.Metric.Registry.Sync.apply_sync( Map.take(params, ["content", "confirmation_endpoint"]) ) do - {:ok, _sync} -> + :ok -> conn |> resp(200, "OK") |> send_resp()