{"action":"closed","issue":{"url":"https://api.github.com/repos/inaka/apns4erl/issues/47","labels_url":"https://api.github.com/repos/inaka/apns4erl/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/inaka/apns4erl/issues/47/comments","events_url":"https://api.github.com/repos/inaka/apns4erl/issues/47/events","html_url":"https://github.com/inaka/apns4erl/issues/47","id":59299568,"number":47,"title":"Handling 'DOWN' connection when sending message using send_message","user":{"login":"monkeyfdude","id":4950527,"avatar_url":"https://avatars.githubusercontent.com/u/4950527?v=3","gravatar_id":"","url":"https://api.github.com/users/monkeyfdude","html_url":"https://github.com/monkeyfdude","followers_url":"https://api.github.com/users/monkeyfdude/followers","following_url":"https://api.github.com/users/monkeyfdude/following{/other_user}","gists_url":"https://api.github.com/users/monkeyfdude/gists{/gist_id}","starred_url":"https://api.github.com/users/monkeyfdude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monkeyfdude/subscriptions","organizations_url":"https://api.github.com/users/monkeyfdude/orgs","repos_url":"https://api.github.com/users/monkeyfdude/repos","events_url":"https://api.github.com/users/monkeyfdude/events{/privacy}","received_events_url":"https://api.github.com/users/monkeyfdude/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-27T21:51:24Z","updated_at":"2015-02-28T05:27:31Z","closed_at":"2015-02-28T05:27:31Z","body":"I observe following code in test_suite:\r\n\r\n\r\n    apns:send_message(\r\n      ?TEST_CONNECTION, ?DEVICE_TOKEN,\r\n      Now ++ \" - Test Alert\", random:uniform(10), \"chime\"),\r\n  receive\r\n    {'DOWN', Ref, _, _, _} = DownMsg ->\r\n      throw(DownMsg);\r\n    DownMsg ->\r\n      throw(DownMsg)\r\n    after 1000 ->\r\n      ok\r\n  end,\r\n\r\nIf I understand this correctly (new to Erlang) its looking for \"DOWN\" message which will come as part of connection monitoring if the connection goes down - Ref = erlang:monitor(process, Pid),\r\n\r\n* Does \"after -> 1000\" mean that apns worker will go down after 1 sec it detected a connection \"DOWN\"?\r\n* Would this mean that message will be lost?\r\n* Would apns_sup restart the worker process, reset the connection?\r\n* What needs to be done for the message which was being sent when connection was detected 'DOWN'\r\n\r\nPlease guide me to understand this better."}}