mix format
This commit is contained in:
@ -5,10 +5,11 @@ defmodule SomethingErlang.Grover do
|
||||
require Logger
|
||||
|
||||
def mount(user) do
|
||||
{:ok, _pid} = DynamicSupervisor.start_child(
|
||||
SomethingErlang.Supervisor.Grovers,
|
||||
{__MODULE__, [self(), user]}
|
||||
)
|
||||
{:ok, _pid} =
|
||||
DynamicSupervisor.start_child(
|
||||
SomethingErlang.Supervisor.Grovers,
|
||||
{__MODULE__, [self(), user]}
|
||||
)
|
||||
end
|
||||
|
||||
def get_thread!(thread_id, page_number) do
|
||||
@ -23,18 +24,20 @@ defmodule SomethingErlang.Grover do
|
||||
GenServer.start_link(
|
||||
__MODULE__,
|
||||
[lv_pid, user],
|
||||
name: via(lv_pid))
|
||||
name: via(lv_pid)
|
||||
)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init([pid, user]) do
|
||||
%{bbuserid: userid, bbpassword: userhash} = user
|
||||
|
||||
initial_state = %{
|
||||
lv_pid: pid,
|
||||
user: %{id: userid, hash: userhash}
|
||||
}
|
||||
|
||||
Logger.debug "init #{userid} #{inspect(pid)}"
|
||||
Logger.debug("init #{userid} #{inspect(pid)}")
|
||||
Process.monitor(pid)
|
||||
{:ok, initial_state}
|
||||
end
|
||||
@ -53,7 +56,8 @@ defmodule SomethingErlang.Grover do
|
||||
|
||||
@impl true
|
||||
def handle_info({:DOWN, _ref, :process, _object, reason}, state) do
|
||||
Logger.debug "received :DOWN from: #{inspect(state.lv_pid)} reason: #{inspect(reason)}"
|
||||
Logger.debug("received :DOWN from: #{inspect(state.lv_pid)} reason: #{inspect(reason)}")
|
||||
|
||||
case reason do
|
||||
{:shutdown, _} -> {:stop, :normal, state}
|
||||
:killed -> {:stop, :normal, state}
|
||||
|
Reference in New Issue
Block a user