TODO: Determine source of stale point data in MARK AS
parent
881585f254
commit
004f7bb1d7
|
@ -26,14 +26,15 @@ defmodule FarmbotCore.Asset.Private do
|
|||
Repo.all(from(data in module, join: lm in subquery(q)))
|
||||
end
|
||||
|
||||
def maybe_get_local_meta(asset, table) do
|
||||
Repo.one(from(lm in LocalMeta, where: lm.asset_local_id == ^asset.local_id and lm.table == ^table))
|
||||
end
|
||||
|
||||
@doc "Mark a document as `dirty` by creating a `local_meta` object"
|
||||
def mark_dirty!(asset, params \\ %{}) do
|
||||
table = table(asset)
|
||||
|
||||
local_meta =
|
||||
Repo.one(
|
||||
from(lm in LocalMeta, where: lm.asset_local_id == ^asset.local_id and lm.table == ^table)
|
||||
) || Ecto.build_assoc(asset, :local_meta)
|
||||
local_meta = maybe_get_local_meta(asset, table) || Ecto.build_assoc(asset, :local_meta)
|
||||
|
||||
## NOTE(Connor): 19/11/13
|
||||
# the try/catch here seems unneeded here, but because of how sqlite/ecto works, it is 100% needed.
|
||||
|
|
|
@ -45,7 +45,6 @@ defmodule FarmbotExt.API.DirtyWorker do
|
|||
(Private.list_dirty(module) ++ Private.list_local(module))
|
||||
|> Enum.uniq()
|
||||
|> Enum.map(fn dirty -> work(dirty, module) end)
|
||||
|
||||
Process.send_after(self(), :do_work, @timeout)
|
||||
{:noreply, state}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue