[erlang-questions] timer:sleep counts incorrectly inside my application

Dmitry mbike2000ru@REDACTED
Thu Jan 12 13:50:01 CET 2017


Hello
It counts perfectly in an erlang console
but here I need to send 70 push tokens with an interval 1 minute - but it sends with intervals 6-10 seconds

send_it(_A, BinToken) ->    timer:sleep(60000),    lager:info("The BinToken is in Send_it: ~p ~n",[BinToken]),

   Body = "{\"app_id\": \"c35654655556445454550a6\",\"contents\": {\"en\": \"English Message\"}, \"include_player_ids\": [\"" ++ binary_to_list(BinToken) ++"\"]}",
   Request = {"https://onesignal.com/api/v1/notifications",              [{"Authorization","Basic YTM25464464546456565QyZDlh"}], "application/json", Body},
   httpc:request(post, Request, [], []).

annoy (BinToken) ->  [send_it(A, BinToken) || A <- lists:seq(1,70)].++++++++++++++++++++++++++++++++++++++++++++++++++++where to dig?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170112/86dc1094/attachment.htm>


More information about the erlang-questions mailing list