diff --git a/lib/towerops_web/controllers/api/v1/gaiia_webhook_controller.ex b/lib/towerops_web/controllers/api/v1/gaiia_webhook_controller.ex index 083b600f..1c90cd7c 100644 --- a/lib/towerops_web/controllers/api/v1/gaiia_webhook_controller.ex +++ b/lib/towerops_web/controllers/api/v1/gaiia_webhook_controller.ex @@ -149,7 +149,9 @@ defmodule ToweropsWeb.Api.V1.GaiiaWebhookController do defp check_timestamp(timestamp_str) do case Integer.parse(timestamp_str) do {ts, ""} -> - age = abs(System.system_time(:second) - ts) + # Gaiia sends timestamps in milliseconds — normalize to seconds + ts_seconds = if ts > 9_999_999_999, do: div(ts, 1000), else: ts + age = abs(System.system_time(:second) - ts_seconds) if age <= @max_age_seconds, do: :ok, else: {:error, :expired} _ ->