From 116f1ada14199059f5851278292bfb90ac1dc2bf Mon Sep 17 00:00:00 2001 From: Carsten Date: Tue, 21 Apr 2026 22:15:35 +0200 Subject: [PATCH] fix(server): only mark hosts offline when endpoint is serving Application.start ran mark_all_offline unconditionally, which meant every "mix run"/"mix ecto.migrate" invocation would flip all connected hosts to offline. Gate the call on Phoenix.Endpoint.server? so non-serving boots don't disturb live state. --- server/lib/server/application.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/lib/server/application.ex b/server/lib/server/application.ex index 6e1b1f5..86c0c05 100644 --- a/server/lib/server/application.ex +++ b/server/lib/server/application.ex @@ -25,7 +25,11 @@ defmodule Server.Application do # for other strategies and supported options opts = [strategy: :one_for_one, name: Server.Supervisor] result = Supervisor.start_link(children, opts) - with {:ok, _} <- result, do: Server.Hosts.mark_all_offline() + + if Phoenix.Endpoint.server?(:server, ServerWeb.Endpoint) do + with {:ok, _} <- result, do: Server.Hosts.mark_all_offline() + end + result end