{"action":"created","issue":{"url":"https://api.github.com/repos/etataurov/asyncio-apns/issues/6","repository_url":"https://api.github.com/repos/etataurov/asyncio-apns","labels_url":"https://api.github.com/repos/etataurov/asyncio-apns/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/etataurov/asyncio-apns/issues/6/comments","events_url":"https://api.github.com/repos/etataurov/asyncio-apns/issues/6/events","html_url":"https://github.com/etataurov/asyncio-apns/issues/6","id":143541655,"number":6,"title":"Better explaination with asyncio","user":{"login":"skrew","id":738170,"avatar_url":"https://avatars.githubusercontent.com/u/738170?v=3","gravatar_id":"","url":"https://api.github.com/users/skrew","html_url":"https://github.com/skrew","followers_url":"https://api.github.com/users/skrew/followers","following_url":"https://api.github.com/users/skrew/following{/other_user}","gists_url":"https://api.github.com/users/skrew/gists{/gist_id}","starred_url":"https://api.github.com/users/skrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skrew/subscriptions","organizations_url":"https://api.github.com/users/skrew/orgs","repos_url":"https://api.github.com/users/skrew/repos","events_url":"https://api.github.com/users/skrew/events{/privacy}","received_events_url":"https://api.github.com/users/skrew/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2016-03-25T16:59:08Z","updated_at":"2016-03-30T15:52:18Z","closed_at":null,"body":"Hi,\r\n\r\nYour example is about sending a simple push, but in major case we need to send thousand of pushs.\r\n\r\nI have a problem with it. I use a Semaphore for sending 50 pushs in concurrency (without it it's so slow ! about 2 pushs / sec) but i can't catch a bad token.\r\n\r\nEG: I have a test push server, and with 188th push, i send back a 400: BadToken error.\r\n\r\nClient side, i got the error but not for the good push/token (190th, 192th, even 189th but not the good one (188)\r\n\r\nI have read there are something with \"futures\" but don't see many good examples on web about handling / playing with that.\r\n\r\nMy current testing code:\r\n\r\n```\r\nasync def send_push4(apns, message, token):\r\n\twith await mysem:\r\n\t\ttry:\r\n\t\t\tawait apns.send_message(message, token)\r\n\t\texcept Exception as APNsError:\r\n\t\t\tprint(\"Error %s for %s\" %(APNsError.status, token))\r\n\r\n\r\nloop = asyncio.get_event_loop()\r\nsem = asyncio.Semaphore(50)\r\nfor i in range(1,200):\r\n        tasks.append(asyncio.async(send_push4(apns, message, token)))\r\nloop.run_until_complete(asyncio.tasks)\r\n```\r\n\r\nThanks for helping.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/etataurov/asyncio-apns/issues/comments/203498938","html_url":"https://github.com/etataurov/asyncio-apns/issues/6#issuecomment-203498938","issue_url":"https://api.github.com/repos/etataurov/asyncio-apns/issues/6","id":203498938,"user":{"login":"skrew","id":738170,"avatar_url":"https://avatars.githubusercontent.com/u/738170?v=3","gravatar_id":"","url":"https://api.github.com/users/skrew","html_url":"https://github.com/skrew","followers_url":"https://api.github.com/users/skrew/followers","following_url":"https://api.github.com/users/skrew/following{/other_user}","gists_url":"https://api.github.com/users/skrew/gists{/gist_id}","starred_url":"https://api.github.com/users/skrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skrew/subscriptions","organizations_url":"https://api.github.com/users/skrew/orgs","repos_url":"https://api.github.com/users/skrew/repos","events_url":"https://api.github.com/users/skrew/events{/privacy}","received_events_url":"https://api.github.com/users/skrew/received_events","type":"User","site_admin":false},"created_at":"2016-03-30T15:52:18Z","updated_at":"2016-03-30T15:52:18Z","body":"@etataurov Just look with my test code. Change range from 200 to 40.000, you will see there are errors before limits hit.\r\n\r\n`Cannot send 34 bytes, flow control window is 17.`\r\n\r\nSomething here, connection are not closed (i think)."}}