diff --git a/buildman/server.py b/buildman/server.py index 6b55fc2b1..6346f4a2e 100644 --- a/buildman/server.py +++ b/buildman/server.py @@ -93,13 +93,8 @@ class BuilderServer(object): logger.debug('Starting server on port %s, with controller on port %s', websocket_port, controller_port) - TASKS = [ - Task(self._initialize(loop, host, websocket_port, controller_port, ssl)), - Task(self._queue_metrics_updater()), - ] - try: - loop.run_until_complete(trollius.wait(TASKS)) + loop.run_until_complete(self._initialize(loop, host, websocket_port, controller_port, ssl)) except KeyboardInterrupt: pass finally: @@ -195,6 +190,7 @@ class BuilderServer(object): @trollius.coroutine def _queue_metrics_updater(self): + logger.debug('Initializing queue metrics updater') while self._current_status == BuildServerStatus.RUNNING: yield From(trollius.sleep(30)) logger.debug('Writing metrics') @@ -212,5 +208,8 @@ class BuilderServer(object): create_wsgi_server(self._controller_app, loop=loop, host=host, port=controller_port, ssl=ssl) yield From(loop.create_server(transport_factory, host, websocket_port, ssl=ssl)) + # Initialize the metrics updater + trollius.async(self._queue_metrics_updater()) + # Initialize the work queue checker. yield From(self._work_checker())