Merge "Make db queries asynchronous in zuul-web"

This commit is contained in:
Zuul
2018-04-12 20:27:05 +00:00
committed by Gerrit Code Review
2 changed files with 18 additions and 2 deletions

View File

@@ -262,10 +262,12 @@ class ZuulWeb(object):
self.log_streaming_handler = LogStreamingHandler(self.rpc)
self.gearman_handler = GearmanHandler(self.rpc)
self._plugin_routes = [] # type: List[zuul.web.handler.BaseWebHandler]
self._connection_handlers = []
connections = connections or []
for connection in connections:
self._plugin_routes.extend(
self._connection_handlers.extend(
connection.getWebHandlers(self, self.info))
self._plugin_routes.extend(self._connection_handlers)
async def _handleWebsocket(self, request):
return await self.log_streaming_handler.processRequest(
@@ -362,6 +364,9 @@ class ZuulWeb(object):
self.event_loop = loop
self.log_streaming_handler.setEventLoop(loop)
for handler in self._connection_handlers:
if hasattr(handler, 'setEventLoop'):
handler.setEventLoop(loop)
app = web.Application()
for method, path, handler in routes: