Fix Elixir integration record mistake
This commit is contained in:
parent
b55ff1438c
commit
f469796260
3 changed files with 12 additions and 6 deletions
|
@ -121,7 +121,9 @@ defmodule GeoTherminator.PumpAPI.Auth.Server do
|
|||
|
||||
{:ok, state}
|
||||
else
|
||||
_ -> :error
|
||||
err ->
|
||||
Logger.error("Could not auth or fetch installations! #{inspect(err)}")
|
||||
:error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
defmodule GeoTherminator.PumpAPI.Device.Server do
|
||||
require Logger
|
||||
require GeoTherminator.PumpAPI.Auth.InstallationInfo
|
||||
|
||||
use GenServer
|
||||
import GeoTherminator.TypedStruct
|
||||
alias GeoTherminator.PumpAPI.Device
|
||||
alias GeoTherminator.PumpAPI.Auth.InstallationInfo
|
||||
alias GeoTherminator.PumpAPI.Auth.Server, as: AuthServer
|
||||
require Logger
|
||||
|
||||
defmodule Options do
|
||||
deftypedstruct(%{
|
||||
|
@ -26,7 +28,7 @@ defmodule GeoTherminator.PumpAPI.Device.Server do
|
|||
@spec start_link(Options.t()) :: GenServer.on_start()
|
||||
def start_link(opts) do
|
||||
GenServer.start_link(__MODULE__, opts,
|
||||
name: {:via, Registry, {Device.Registry, opts.installation.id}}
|
||||
name: {:via, Registry, {Device.Registry, InstallationInfo.record(opts.installation, :id)}}
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -119,7 +121,7 @@ defmodule GeoTherminator.PumpAPI.Device.Server do
|
|||
Task.async_stream(
|
||||
[&Device.API.status/2, &Device.API.register_info/2, &Device.API.opstat/2],
|
||||
& &1.(user, state.device),
|
||||
timeout: Application.get_env(:geo_therminator, :api_timeout)
|
||||
timeout: Application.fetch_env!(:geo_therminator, :api_timeout)
|
||||
)
|
||||
|> Enum.map(fn {:ok, val} -> val end)
|
||||
|
||||
|
@ -133,7 +135,7 @@ defmodule GeoTherminator.PumpAPI.Device.Server do
|
|||
Process.send_after(
|
||||
self(),
|
||||
:refresh_status,
|
||||
Application.get_env(:geo_therminator, :api_refresh)
|
||||
Application.fetch_env!(:geo_therminator, :api_refresh)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
defmodule GeoTherminatorWeb.MainLive.Index do
|
||||
require Logger
|
||||
use GeoTherminatorWeb, :live_view
|
||||
|
||||
@impl Phoenix.LiveView
|
||||
|
@ -55,7 +56,8 @@ defmodule GeoTherminatorWeb.MainLive.Index do
|
|||
)
|
||||
end
|
||||
|
||||
_ ->
|
||||
err ->
|
||||
Logger.debug("Error starting auth server: #{inspect(err)}")
|
||||
assign(socket, error: true)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue