Minor formatting issues.
parent
02f16082b9
commit
aecb77b48a
|
@ -6,27 +6,28 @@ defmodule FarmbotCore.Asset do
|
|||
"""
|
||||
|
||||
alias FarmbotCore.Asset.{
|
||||
Repo,
|
||||
CriteriaRetriever,
|
||||
Device,
|
||||
DeviceCert,
|
||||
FarmwareEnv,
|
||||
FirstPartyFarmware,
|
||||
FarmwareInstallation,
|
||||
FarmEvent,
|
||||
FarmwareEnv,
|
||||
FarmwareInstallation,
|
||||
FbosConfig,
|
||||
FirmwareConfig,
|
||||
FirstPartyFarmware,
|
||||
Peripheral,
|
||||
PinBinding,
|
||||
Point,
|
||||
PointGroup,
|
||||
Private,
|
||||
PublicKey,
|
||||
Regimen,
|
||||
RegimenInstance,
|
||||
Sequence,
|
||||
Repo,
|
||||
Sensor,
|
||||
SensorReading,
|
||||
Sequence,
|
||||
Tool,
|
||||
CriteriaRetriever
|
||||
}
|
||||
|
||||
alias FarmbotCore.AssetSupervisor
|
||||
|
@ -259,7 +260,6 @@ defmodule FarmbotCore.Asset do
|
|||
# by default, not a merge action.
|
||||
# MORE NOTES: Mixed keys (symbol vs. string) will crash this FN.
|
||||
# Let's just stringify everything...
|
||||
IO.inspect(params, label: "===== ORIGINAL PARAMS")
|
||||
new_meta = params[:meta] || params["meta"] || %{}
|
||||
old_meta = point.meta || %{}
|
||||
updated_meta = Map.merge(old_meta, new_meta)
|
||||
|
@ -268,7 +268,6 @@ defmodule FarmbotCore.Asset do
|
|||
|> Enum.map(fn {k, v} -> {"#{k}", v} end)
|
||||
|> Map.new()
|
||||
|
||||
IO.inspect(clean_params, label: "=========== CLEAN PARAMS")
|
||||
Repo.get_by(Point, id: point.id)
|
||||
|> Point.changeset(clean_params)
|
||||
|> Repo.update()
|
||||
|
|
|
@ -44,9 +44,7 @@ defmodule FarmbotExt.API.DirtyWorker do
|
|||
def handle_info(:do_work, %{module: module} = state) do
|
||||
(Private.list_dirty(module) ++ Private.list_local(module))
|
||||
|> Enum.uniq()
|
||||
|> Enum.map(fn dirty ->
|
||||
work(dirty, module)
|
||||
end)
|
||||
|> Enum.map(fn dirty -> work(dirty, module) end)
|
||||
|
||||
Process.send_after(self(), :do_work, @timeout)
|
||||
{:noreply, state}
|
||||
|
@ -71,13 +69,15 @@ defmodule FarmbotExt.API.DirtyWorker do
|
|||
# Invalid data, but the API didn't say why
|
||||
{:ok, %{status: s, body: _body}} when s > 399 and s < 500 ->
|
||||
FarmbotCore.Logger.error(2, "HTTP Error #{s}. #{inspect(dirty)}")
|
||||
|
||||
module.changeset(dirty)
|
||||
|> Map.put(:valid?, false)
|
||||
|> handle_changeset(module)
|
||||
|
||||
# HTTP Error. (500, network error, timeout etc.)
|
||||
error ->
|
||||
FarmbotCore.Logger.error(2,
|
||||
FarmbotCore.Logger.error(
|
||||
2,
|
||||
"[#{module} #{dirty.local_id} #{inspect(self())}] HTTP Error: #{module} #{
|
||||
inspect(error)
|
||||
}"
|
||||
|
@ -99,7 +99,7 @@ defmodule FarmbotExt.API.DirtyWorker do
|
|||
end)
|
||||
|> Enum.join("\n")
|
||||
|
||||
FarmbotCore.Logger.error(3, "Failed to sync: #{module} \n #{message}")
|
||||
FarmbotCore.Logger.error(3, "Failed to sync: #{module} \n #{message}")
|
||||
_ = Repo.delete!(data)
|
||||
:ok
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue