Fix Can't connect to compute local on some computers

Chicken and egg problem we try to connect to compute
before http was available. I rewrote the code to prevent
erase of settings and rollback the beta4 code for init.

Fix #946
This commit is contained in:
Julien Duponchelle committed 2017-03-21 18:06:45 +01:00
1 parent 1566d7f12a
commit 8712866489
3 files changed
+20 -3

No files matched your search

+9 -1
View File
@@ -186,6 +186,13 @@ class WebServer:
atexit.register(close_asyncio_loop)
@asyncio.coroutine
def _on_startup(self, *args):
"""
Called when the HTTP server start
"""
yield from Controller.instance().start()
def run(self):
"""
Starts the server.
@@ -225,8 +232,9 @@ class WebServer:
for key, val in os.environ.items():
log.debug("ENV %s=%s", key, val)
self._loop.run_until_complete(Controller.instance().start())
self._app = aiohttp.web.Application()
# Background task started with the server
self._app.on_startup.append(self._on_startup)
# Allow CORS for this domains
cors = aiohttp_cors.setup(self._app, defaults={