Use refresh_service! to reduce cli calls

This commit is contained in:
Harshad Sharma 2024-05-19 07:28:47 +05:30
parent d6b2522fdc
commit 699cd61e0e

View file

@ -81,8 +81,10 @@ defmodule Freedive.Api.Service do
broadcast(:stdlog, %{name: name, log: std_to_log(reason)})
end
broadcast(:refreshed, service_details(name))
curr_service = state[:services][name]
refreshed_service = refresh_service!(curr_service)
state = %{state | services: Map.put(state[:services], name, refreshed_service)}
broadcast(:refreshed, refreshed_service)
{:noreply, state}
end