fix celeryscript ast encodeing.

This commit is contained in:
connor rigby 2017-11-13 12:29:34 -08:00
parent b782fb5f7e
commit a67508eac5
2 changed files with 7 additions and 4 deletions

View file

@ -193,8 +193,8 @@ defmodule Farmbot.BotState do
@doc "Emit an AST."
def emit(%AST{} = ast) do
kind = Module.split(ast.kind) |> List.last |> Macro.underscore()
GenStage.call(__MODULE__, {:emit, %{ast | kind: kind}})
# kind = Module.split(ast.kind) |> List.last |> Macro.underscore()
GenStage.call(__MODULE__, {:emit, ast})
end
@doc "Get user env."

View file

@ -148,8 +148,11 @@ defmodule Farmbot.BotState.Transport.AMQP do
end
defp emit_cs(chan, bot, cs) do
json = Poison.encode!(cs)
:ok = AMQP.Basic.publish chan, @exchange, "bot.#{bot}.from_device", json
with {:ok, map} <- Farmbot.CeleryScript.AST.encode(cs),
{:ok, json} <- Poison.encode(map)
do
:ok = AMQP.Basic.publish chan, @exchange, "bot.#{bot}.from_device", json
end
end
defp push_bot_state(chan, bot, state) do