fix celeryscript ast encodeing.
This commit is contained in:
parent
b782fb5f7e
commit
a67508eac5
|
@ -193,8 +193,8 @@ defmodule Farmbot.BotState do
|
||||||
|
|
||||||
@doc "Emit an AST."
|
@doc "Emit an AST."
|
||||||
def emit(%AST{} = ast) do
|
def emit(%AST{} = ast) do
|
||||||
kind = Module.split(ast.kind) |> List.last |> Macro.underscore()
|
# kind = Module.split(ast.kind) |> List.last |> Macro.underscore()
|
||||||
GenStage.call(__MODULE__, {:emit, %{ast | kind: kind}})
|
GenStage.call(__MODULE__, {:emit, ast})
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc "Get user env."
|
@doc "Get user env."
|
||||||
|
|
|
@ -148,8 +148,11 @@ defmodule Farmbot.BotState.Transport.AMQP do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp emit_cs(chan, bot, cs) do
|
defp emit_cs(chan, bot, cs) do
|
||||||
json = Poison.encode!(cs)
|
with {:ok, map} <- Farmbot.CeleryScript.AST.encode(cs),
|
||||||
:ok = AMQP.Basic.publish chan, @exchange, "bot.#{bot}.from_device", json
|
{:ok, json} <- Poison.encode(map)
|
||||||
|
do
|
||||||
|
:ok = AMQP.Basic.publish chan, @exchange, "bot.#{bot}.from_device", json
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp push_bot_state(chan, bot, state) do
|
defp push_bot_state(chan, bot, state) do
|
||||||
|
|
Loading…
Reference in a new issue