]> git.ipfire.org Git - pbs.git/commitdiff
hub: Shutdown builders if we don't need them any more
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 18 Jun 2022 12:22:38 +0000 (12:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 18 Jun 2022 12:22:38 +0000 (12:22 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/hub/queue.py

index 06fed704776ad387e97c65211456d6ef75c2b93e..f2d42ce90c4504e1d8aa068b5abd68b317454cc0 100644 (file)
@@ -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.