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,7 +30,8 @@ from sanic.response import HTTPResponse
try: try:
import uvloop import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) if not isinstance(asyncio.get_event_loop_policy(), uvloop.EventLoopPolicy):
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
except ImportError: except ImportError:
pass pass