Skip to content

Commit

Permalink
Address some Diaylzer and Credo warnings (#1941)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshk authored Mar 5, 2025
1 parent 6ee8b9c commit b8f10be
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
32 changes: 17 additions & 15 deletions lib/nerves_hub/deployments.ex
Original file line number Diff line number Diff line change
Expand Up @@ -629,35 +629,37 @@ defmodule NervesHub.Deployments do
end

def start_deployments_distributed_orchestrator_event(deployment) do
DistributedOrchestrator.start_orchestrator(deployment)
_ = DistributedOrchestrator.start_orchestrator(deployment)

:ok
end

def shutdown_deployments_distributed_orchestrator_event(deployment) do
Phoenix.Channel.Server.broadcast(
NervesHub.PubSub,
"orchestrator:deployment:#{deployment.id}",
"deactivated",
%{}
)
_ =
Phoenix.Channel.Server.broadcast(
NervesHub.PubSub,
"orchestrator:deployment:#{deployment.id}",
"deactivated",
%{}
)

:ok
end

def deployment_activated_event(deployment) do
DistributedOrchestrator.start_orchestrator(deployment)
_ = DistributedOrchestrator.start_orchestrator(deployment)

:ok
end

def deployment_deactivated_event(deployment) do
Phoenix.Channel.Server.broadcast(
NervesHub.PubSub,
"orchestrator:deployment:#{deployment.id}",
"deactivated",
%{}
)
_ =
Phoenix.Channel.Server.broadcast(
NervesHub.PubSub,
"orchestrator:deployment:#{deployment.id}",
"deactivated",
%{}
)

:ok
end
Expand All @@ -668,7 +670,7 @@ defmodule NervesHub.Deployments do
broadcast(deployment, "deleted")
end

broadcast(:monitor, "deployments/delete", %{deployment_id: deployment.id})
_ = broadcast(:monitor, "deployments/delete", %{deployment_id: deployment.id})

:ok
end
Expand Down
2 changes: 2 additions & 0 deletions lib/nerves_hub/devices/pinned_device.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ defmodule NervesHub.Devices.PinnedDevice do
alias NervesHub.Devices.Device
alias NervesHub.Devices.PinnedDevice

@type t :: %__MODULE__{}

@required [:user_id, :device_id]
schema "pinned_devices" do
belongs_to(:user, User)
Expand Down
10 changes: 4 additions & 6 deletions lib/nerves_hub/scripts/runner.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ defmodule NervesHub.Scripts.Runner do
end

def send(device, command) do
try do
{:ok, pid} = start_link(device)
{:ok, GenServer.call(pid, {:send, command.text}, 10_000)}
catch
:exit, _ -> {:error, "device not responding"}
end
{:ok, pid} = start_link(device)
{:ok, GenServer.call(pid, {:send, command.text}, 10_000)}
catch
:exit, _ -> {:error, "device not responding"}
end

def start_link(device) do
Expand Down

0 comments on commit b8f10be

Please sign in to comment.