Hi All,
I think I’m going somewhat crazy here.
In my controller
I have code like:
def pin_transfer(conn, %{"uid" => uid} = _params) do
case SystemInterface.get_pin(uid) do
%{"pin" => pin} ->
## ********** Check 1 **********
render(conn, :choose,
next_page: "show",
title: "PIN",
method: "GET",
uid: uid,
name: "key-transfer",
action: "/gateways/show",
pin: pin)
_ ->
conn
|> put_flash(:error, "Can't initiate pin transfer")
|> show(%{"id" => "show", "uid" => uid})
end
end
On the rendered page the user selects a button that causes the router
to call:
def display(conn, %{"id" => "show", "uid" => uid, "pin" => _} = _params) do
## ********** Check 2 **********
case SystemInterface.wait_for_transfer_complete() do
....
Now, here’s what’s odd. The same Elixir process (pid) handles both calls (as shown by a call to self()
. If I check the processes’ message queue at Check 1
using Process.info(self())
I see a number of messages in the message queue. If I check the message queue at Check 2
the message queue is empty. It’s like something drains the mailbox.
Is that by intent?