buildman: initialize queuemetrics asynchronously

This commit is contained in:
Jimmy Zelinskie 2015-02-25 13:55:18 -05:00
parent b4b06ec8c8
commit 346d6b933a

View file

@ -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())