{"action":"opened","issue":{"url":"https://api.github.com/repos/vibora-io/vibora/issues/78","repository_url":"https://api.github.com/repos/vibora-io/vibora","labels_url":"https://api.github.com/repos/vibora-io/vibora/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/vibora-io/vibora/issues/78/comments","events_url":"https://api.github.com/repos/vibora-io/vibora/issues/78/events","html_url":"https://github.com/vibora-io/vibora/issues/78","id":335383049,"node_id":"MDU6SXNzdWUzMzUzODMwNDk=","number":78,"title":"Automatic import of uvloop ","user":{"login":"grigi","id":1309160,"node_id":"MDQ6VXNlcjEzMDkxNjA=","avatar_url":"https://avatars2.githubusercontent.com/u/1309160?v=4","gravatar_id":"","url":"https://api.github.com/users/grigi","html_url":"https://github.com/grigi","followers_url":"https://api.github.com/users/grigi/followers","following_url":"https://api.github.com/users/grigi/following{/other_user}","gists_url":"https://api.github.com/users/grigi/gists{/gist_id}","starred_url":"https://api.github.com/users/grigi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grigi/subscriptions","organizations_url":"https://api.github.com/users/grigi/orgs","repos_url":"https://api.github.com/users/grigi/repos","events_url":"https://api.github.com/users/grigi/events{/privacy}","received_events_url":"https://api.github.com/users/grigi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-25T12:21:03Z","updated_at":"2018-06-25T12:21:03Z","closed_at":null,"author_association":"NONE","body":"**Describe the bug**\r\n`vibora.client` is rather fragile right now. When I try to change the session and/or event loop I end up with weird errors.\r\nIt appears that uvloop is already set up when importing `vibora`.\r\nI don't think this is valid behaviour, as having the event loop or the default session transparently creating objects, replacing the even loop is not ideal.\r\n\r\n**To Reproduce**\r\nUsing CPython 3.6\r\n```py\r\nfrom vibora import client\r\nimport asyncio\r\nimport uvloop\r\nasyncio.set_event_loop_policy(uvloop.EventLoopPolicy())\r\n\r\ndef fetch():\r\n    await client.get('http://127.0.0.1/index.html')\r\n\r\nloop = asyncio.get_event_loop()\r\nloop.run_until_complete(fetch())\r\n```\r\nWill fail with\r\n```\r\nRuntimeError: Task <Task pending coro=<worker() running at /app/vibora/bench_uvloop.py:19> cb=[<TaskWakeupMethWrapper object at 0x7f91cb9922b8>()]> got Future <Future pending> attached to a different loop\r\n```\r\n\r\n**Expected behavior**\r\nTo not automatically replace the event loop.\r\nTo not automatically create a session object tied to an even loop on import\r\n\r\n**Extra info**\r\nThis is part of evaluating/using this as part of an existing project.\r\nI have actually found cases where for the use-case we have (low latency) using `uvloop` can randomly introduce latencies, so we tend to run some components without uvloop for best performance.\r\nThis behaviour will also cause lots of confusion."}}
{"actor":{"display_login":"grigi"}}