From: Michael Tremer Date: Sat, 18 Jun 2022 12:22:38 +0000 (+0000) Subject: hub: Shutdown builders if we don't need them any more X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa1f40345c2fd5cbd36c0f51d509772f325de129;p=pbs.git hub: Shutdown builders if we don't need them any more Signed-off-by: Michael Tremer --- diff --git a/src/hub/queue.py b/src/hub/queue.py index 06fed704..f2d42ce9 100644 --- a/src/hub/queue.py +++ b/src/hub/queue.py @@ -29,7 +29,7 @@ log = logging.getLogger("pakfire.hub.queue") # A list of all builders that have a connection connections = [] -def dispatch_jobs(backend): +async def dispatch_jobs(backend): """ Will be called regularly and will dispatch any pending jobs to any available builders @@ -68,6 +68,9 @@ def dispatch_jobs(backend): log.debug(" No jobs processable for %s" % builder) + # If there is no job for the builder, we might as well shut it down + await builder.stop() + class QueueHandler(BackendMixin, HTTPBasicAuthMixin, tornado.websocket.WebSocketHandler): """ Builders connect to this handler which will add them to a list of connections.