Skip to content

Commit

Permalink
doc tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
ono committed Mar 8, 2021
1 parent 42bf0b8 commit 20b20a9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/amqp/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,17 @@ defmodule AMQP.Application do
....
def handle_info(:subscribe, state) do
subscribe()
{:noreply, state}
case subscribe() do
{:ok, chan} ->
{:noreply, Map.put(state, :channel, chan)}
_ ->
{:noreply, state}
end
end
def handle_info({:DOWN, _, :process, pid, reason}, state) do
def handle_info({:DOWN, _, :process, pid, reason}, %{channel: %{pid: pid}} = state) do
send(self(), :subscribe)
{:noreply, state}
{:noreply, Map.put(state, :channel, nil)}
end
defp subscribe() do
Expand Down

0 comments on commit 20b20a9

Please sign in to comment.