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:
parent
2011f3a0b2
commit
ae91852cd5
|
@ -30,6 +30,7 @@ from sanic.response import HTTPResponse
|
||||||
try:
|
try:
|
||||||
import uvloop
|
import uvloop
|
||||||
|
|
||||||
|
if not isinstance(asyncio.get_event_loop_policy(), uvloop.EventLoopPolicy):
|
||||||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user