<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">1 февр. 2017 г., в 16:00, Dmitry <<a href="mailto:mbike2000ru@yahoo.com" class="">mbike2000ru@yahoo.com</a>> написал(а):</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;" class=""><div id="yui_3_16_0_ym19_1_1485951721255_41869" class="">Hello,</div><div id="yui_3_16_0_ym19_1_1485951721255_41869" class=""><br class=""></div><div id="yui_3_16_0_ym19_1_1485951721255_41869" class=""><br class=""></div><div id="yui_3_16_0_ym19_1_1485951721255_41869" class=""><br class=""></div><div id="yui_3_16_0_ym19_1_1485951721255_41869" class="">The code which spawns new processes works in normal situation (when it is triggered from another application), but it seams that when it is called from send_all it does not work as expected:</div><div id="yui_3_16_0_ym19_1_1485951721255_41869" class="">+++++++++++++++++++++++++++++++++++++++++++++++++++++++</div><div id="yui_3_16_0_ym19_1_1485951721255_41869" class=""><br class=""></div><div id="yui_3_16_0_ym19_1_1485951721255_43689" class="">handle_cast({send_all}, State=#state{pgconn=Conn}) -></div><div id="yui_3_16_0_ym19_1_1485951721255_43690" class="">  SQLQuery = "select mobile_phone from push_tokens as pt inner join employees as e on e.id = pt.employee_id where e.active = true and pt.app_voip_token is not null",</div><div id="yui_3_16_0_ym19_1_1485951721255_43691" class="">  {ok, _, Res} = epgsql:squery(Conn, SQLQuery),</div><div id="yui_3_16_0_ym19_1_1485951721255_43692" class="">   io:format("Send_all was queried~n"),</div><div id="yui_3_16_0_ym19_1_1485951721255_43693" class="">  <b id="yui_3_16_0_ym19_1_1485951721255_43753" class="">[connect_down(binary_to_list(Phone)) || {Phone} <- Res],</b></div><div id="yui_3_16_0_ym19_1_1485951721255_43694" class="">  {noreply, State};</div><div dir="ltr" id="yui_3_16_0_ym19_1_1485951721255_43695" class="">++++++++++++++++++++++++++++++++++++++++++++++++++++++++</div><div dir="ltr" id="yui_3_16_0_ym19_1_1485951721255_43695" class=""><br class=""></div><div dir="ltr" id="yui_3_16_0_ym19_1_1485951721255_43695" class="">The problem that annoy is called only once (but it had to call send_it - 124 times)</div><div dir="ltr" id="yui_3_16_0_ym19_1_1485951721255_43695" class=""><br class=""></div><div dir="ltr" id="yui_3_16_0_ym19_1_1485951721255_43695" class="">The question - how to debug such application: how to trace whats going on in the "annoy" function. I use spawn_monitor to detect link failure.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1485951721255_43695" class="">++++++++++++++++++++++++++++++++++++++++++++++++++++++++</div><div dir="ltr" id="yui_3_16_0_ym19_1_1485951721255_43695" class=""><div dir="ltr" id="yui_3_16_0_ym19_1_1485951721255_43840" class=""><b class="">annoy (BinToken) -></b></div><div dir="ltr" id="yui_3_16_0_ym19_1_1485951721255_43841" class=""><b class="">  [send_it(A, BinToken) || A <- lists:seq(1,124)].</b></div></div><div dir="ltr" id="yui_3_16_0_ym19_1_1485951721255_43695" class="">++++++++++++++++++++++++++++++++++++++++++++++++++++++++</div></div></div></div></blockquote>A good start would be to use proc_lib for your troubles, it’ll allow you to see traces of processes exiting improperly. Do you actually receive messages from the monitor anywhere?</div><br class=""></body></html>