check for already set asyncio event loop policy (#1637)

* check for already set asyncio event loop policy

* fix linting warning
This commit is contained in:
Subham Roy 2019-08-28 22:00:23 +05:30 committed by Stephen Sadowski
parent 2011f3a0b2
commit ae91852cd5

View File

@ -30,6 +30,7 @@ from sanic.response import HTTPResponse
try:
import uvloop
if not isinstance(asyncio.get_event_loop_policy(), uvloop.EventLoopPolicy):
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
except ImportError:
pass