{"action":"closed","issue":{"url":"https://api.github.com/repos/zeromq/pyzmq/issues/856","repository_url":"https://api.github.com/repos/zeromq/pyzmq","labels_url":"https://api.github.com/repos/zeromq/pyzmq/issues/856/labels{/name}","comments_url":"https://api.github.com/repos/zeromq/pyzmq/issues/856/comments","events_url":"https://api.github.com/repos/zeromq/pyzmq/issues/856/events","html_url":"https://github.com/zeromq/pyzmq/issues/856","id":163916645,"number":856,"title":"zmq.asyncio is broken (examples inside)","user":{"login":"RojavaCrypto","id":19536664,"avatar_url":"https://avatars.githubusercontent.com/u/19536664?v=3","gravatar_id":"","url":"https://api.github.com/users/RojavaCrypto","html_url":"https://github.com/RojavaCrypto","followers_url":"https://api.github.com/users/RojavaCrypto/followers","following_url":"https://api.github.com/users/RojavaCrypto/following{/other_user}","gists_url":"https://api.github.com/users/RojavaCrypto/gists{/gist_id}","starred_url":"https://api.github.com/users/RojavaCrypto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RojavaCrypto/subscriptions","organizations_url":"https://api.github.com/users/RojavaCrypto/orgs","repos_url":"https://api.github.com/users/RojavaCrypto/repos","events_url":"https://api.github.com/users/RojavaCrypto/events{/privacy}","received_events_url":"https://api.github.com/users/RojavaCrypto/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-05T18:34:29Z","updated_at":"2016-07-05T20:35:11Z","closed_at":"2016-07-05T20:35:11Z","body":"This code works as expected (using normal asyncio module):\r\n```python\r\nimport asyncio\r\nqueue = asyncio.Queue()\r\n\r\nasync def pushing():\r\n    while True:\r\n        await queue.put(\"hello\")\r\n        await asyncio.sleep(1)\r\n\r\nasync def pulling():\r\n    while True:\r\n        greeting = await queue.get()\r\n        print(greeting)\r\n\r\ndef asyncio_loop():\r\n    import asyncio\r\n    loop = asyncio.get_event_loop()\r\n    tasks = [\r\n        pushing(),\r\n        pulling()\r\n    ]\r\n    loop.run_until_complete(asyncio.wait(tasks))\r\n    loop.close()\r\n\r\nif __name__ == '__main__':\r\n    asyncio_loop()\r\n```\r\n\r\nWhereas the code using zmq.asyncio hangs (it's not resuming the functions):\r\n\r\n```python\r\nimport asyncio\r\nqueue = asyncio.Queue()\r\n\r\nasync def pushing():\r\n    while True:\r\n        await queue.put(\"hello\")\r\n        await asyncio.sleep(1)\r\n\r\nasync def pulling():\r\n    while True:\r\n        greeting = await queue.get()\r\n        print(greeting)\r\n\r\ndef zmq_async_loop():\r\n    import zmq.asyncio\r\n    loop = zmq.asyncio.install()\r\n    tasks = [\r\n        pushing(),\r\n        pulling()\r\n    ]\r\n    loop.run_until_complete(asyncio.wait(tasks))\r\n    loop.close()\r\n\r\nif __name__ == '__main__':\r\n    zmq_async_loop()\r\n```"}}
{"actor":{"display_login":"RojavaCrypto"}}