Skip to content

Commit

Permalink
Also check if the product has the health extension enabled (#1940)
Browse files Browse the repository at this point in the history
We were checking the device extension settings, but not the product.

Part 1 of #1939
  • Loading branch information
joshk authored Mar 4, 2025
1 parent 77612a6 commit 601f629
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/nerves_hub_web/live/devices/show.ex
Original file line number Diff line number Diff line change
Expand Up @@ -490,15 +490,21 @@ defmodule NervesHubWeb.Live.Devices.Show do
|> Map.keys()
|> Enum.map(&to_string/1)

defp schedule_health_check_timer(%{assigns: %{device: device}} = socket) do
if connected?(socket) and device.extensions.health do
defp schedule_health_check_timer(socket) do
%{device: device, product: product} = socket.assigns

if connected?(socket) and health_extension_enabled?(product, device) do
timer_ref = Process.send_after(self(), :check_health_interval, 500)
assign(socket, :health_check_timer, timer_ref)
else
assign(socket, :health_check_timer, nil)
end
end

defp health_extension_enabled?(product, device) do
product.extensions.health and device.extensions.health
end

defp audit_log_assigns(
%{assigns: %{device: device, page_number: page_number, page_size: page_size}} = socket
) do
Expand Down

0 comments on commit 601f629

Please sign in to comment.