Work around a bug in uasyncio's create_server() function
This commit is contained in:
@@ -162,7 +162,14 @@ class Microdot(BaseMicrodot):
|
|||||||
host=host, port=port))
|
host=host, port=port))
|
||||||
|
|
||||||
self.server = await asyncio.start_server(serve, host, port)
|
self.server = await asyncio.start_server(serve, host, port)
|
||||||
await self.server.wait_closed()
|
while True:
|
||||||
|
try:
|
||||||
|
await self.server.wait_closed()
|
||||||
|
break
|
||||||
|
except AttributeError: # pragma: no cover
|
||||||
|
# the task hasn't been initialized in the server object yet
|
||||||
|
# wait a bit and try again
|
||||||
|
await asyncio.sleep(0.1)
|
||||||
|
|
||||||
def run(self, host='0.0.0.0', port=5000, debug=False):
|
def run(self, host='0.0.0.0', port=5000, debug=False):
|
||||||
"""Start the web server. This function does not normally return, as
|
"""Start the web server. This function does not normally return, as
|
||||||
|
|||||||
Reference in New Issue
Block a user