Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also check if the product has the health extension enabled #1940

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading