Fix CeleryScript channel not reconnecting even more

pull/974/head
Connor Rigby 2019-09-10 10:25:51 -07:00
parent e0ec95875e
commit 5776c0592d
No known key found for this signature in database
GPG Key ID: 29A88B24B70456E0
2 changed files with 4 additions and 1 deletions

View File

@ -26,7 +26,8 @@ defmodule FarmbotExt.AMQP.CeleryScriptChannel do
def init(args) do
jwt = Keyword.fetch!(args, :jwt)
Process.flag(:sensitive, true)
{:ok, %State{conn: nil, chan: nil, jwt: jwt, rpc_requests: %{}}, 0}
send(self(), :timeout)
{:ok, %State{conn: nil, chan: nil, jwt: jwt, rpc_requests: %{}}}
end
def terminate(reason, state) do

View File

@ -64,6 +64,8 @@ defmodule FarmbotExt.AMQP.ConnectionWorker do
{:ok, _} <- maybe_purge(chan, chan_name, purge?),
:ok <- Queue.bind(chan, chan_name, @exchange, routing_key: route),
{:ok, _} <- Basic.consume(chan, chan_name, self(), no_ack: true) do
Process.link(conn.pid)
Process.link(chan.pid)
%{conn: conn, chan: chan}
else
nil -> %{conn: nil, chan: nil}