Merge branch 'feat/optional-uvloop-use' of github.com:prryplatypus/sanic into tests/optional-uvloop-use
This commit is contained in:
commit
250c5cf60d
@ -12,6 +12,7 @@ UVLOOP_INSTALLED = False
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import uvloop # type: ignore # noqa
|
import uvloop # type: ignore # noqa
|
||||||
|
|
||||||
UVLOOP_INSTALLED = True
|
UVLOOP_INSTALLED = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
@ -12,9 +12,7 @@ def use_uvloop() -> None:
|
|||||||
"""
|
"""
|
||||||
import uvloop # type: ignore
|
import uvloop # type: ignore
|
||||||
|
|
||||||
if not isinstance(
|
if not isinstance(asyncio.get_event_loop_policy(), uvloop.EventLoopPolicy):
|
||||||
asyncio.get_event_loop_policy(), uvloop.EventLoopPolicy
|
|
||||||
):
|
|
||||||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user