{"action":"closed","issue":{"url":"https://api.github.com/repos/tarantool/queue/issues/28","labels_url":"https://api.github.com/repos/tarantool/queue/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/tarantool/queue/issues/28/comments","events_url":"https://api.github.com/repos/tarantool/queue/issues/28/events","html_url":"https://github.com/tarantool/queue/issues/28","id":107963224,"number":28,"title":"async way to work with queue","user":{"login":"bigbes","id":495636,"avatar_url":"https://avatars.githubusercontent.com/u/495636?v=3","gravatar_id":"","url":"https://api.github.com/users/bigbes","html_url":"https://github.com/bigbes","followers_url":"https://api.github.com/users/bigbes/followers","following_url":"https://api.github.com/users/bigbes/following{/other_user}","gists_url":"https://api.github.com/users/bigbes/gists{/gist_id}","starred_url":"https://api.github.com/users/bigbes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bigbes/subscriptions","organizations_url":"https://api.github.com/users/bigbes/orgs","repos_url":"https://api.github.com/users/bigbes/repos","events_url":"https://api.github.com/users/bigbes/events{/privacy}","received_events_url":"https://api.github.com/users/bigbes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tarantool/queue/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-23T17:01:47Z","updated_at":"2016-01-19T14:12:40Z","closed_at":"2016-01-19T14:12:40Z","body":"There's one connection and two workers trying to get packet from server:\r\n```\r\nimport asyncio\r\nimport aiotarantool\r\n\r\n@asyncio.coroutine\r\ndef process_job(tnt):\r\n    while True:\r\n        t = yield from tnt.call(\"box.queue.tube.t1:take\", 0.1)\r\n        if not t:\r\n            break\r\n        \r\n        tid = t.data[0][0]\r\n        print(t.data)\r\n        k = yield from tnt.call(\"box.queue.tube.t1:ack\", tid)\r\n\r\nloop = asyncio.get_event_loop()\r\n\r\ntnt = aiotarantool.connect(\"127.0.0.1\", 3301)\r\ntasks = [asyncio.async(process_job(tnt))\r\n         for _ in range(10)]\r\n\r\nloop.run_until_complete(asyncio.wait(tasks))\r\nloop.run_until_complete(tnt.close())\r\nloop.close()\r\n```\r\nresult - we have error that comes from second worker if queue is empty:\r\n```\r\ntarantool.error.DatabaseError: (3, b\"Duplicate key exists in unique index 'consumer' in space '_queue_consumers'\")\r\n```"}}