Skip to content

Commit

Permalink
check for already set asyncio event loop policy (#1637)
Browse files Browse the repository at this point in the history
* check for already set asyncio event loop policy

* fix linting warning
  • Loading branch information
syfluqs authored and sjsadowski committed Aug 28, 2019
1 parent 2011f3a commit ae91852
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sanic/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
try:
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:
pass

Expand Down

0 comments on commit ae91852

Please sign in to comment.