Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions httpstan/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
from typing import Optional

import aiohttp.web
import uvloop

try:
from uvloop import EventLoopPolicy
except ImportError:
EventLoopPolicy = asyncio.DefaultEventLoopPolicy

import httpstan.routes

Expand Down Expand Up @@ -59,7 +63,7 @@ class Server(threading.Thread):
def __init__(self, host: str = "127.0.0.1", port: Optional[int] = None) -> None:
super().__init__()
self.host, self.port = host, port
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
asyncio.set_event_loop_policy(EventLoopPolicy())
self.loop = asyncio.new_event_loop() # control will be passed to thread
self.app = make_app()
self.runner = aiohttp.web.AppRunner(self.app)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ apispec<1,>=0.21
protobuf<4,>=3.3.0
setuptools>=28.8
ujson<2,>=1.3
uvloop<1,>=0.11.2
uvloop<1,>=0.11.2; sys_platform != "win32" or implementation_name == "PyPy"