Skip to content

Instantly share code, notes, and snippets.

@chazsconi
chazsconi / controller.ex
Last active Jul 27, 2019
Handling long polling and trapping shutdown
View controller.ex
def wait(conn, _params) do
Logger.info("start - #{inspect(self())}")
Logger.info("Sleeping...")
Process.flag(:trap_exit, true)
result =
receive do
{:EXIT, _caller, :shutdown} ->
Logger.info("Got shutdown")
:shutdown
You can’t perform that action at this time.