chiark / gitweb /
build: add global soft timeout of 12 hours
authorMarcus Hoffmann <bubu@bubu1.eu>
Fri, 19 Jan 2018 21:35:06 +0000 (22:35 +0100)
committerMarcus Hoffmann <bubu@bubu1.eu>
Mon, 22 Jan 2018 15:02:49 +0000 (16:02 +0100)
Only start new builds for 12 hours. This ensures we publish new builds
often enough even on long backlogs.

This could be made configurable at a later point.

fdroidserver/build.py

index 9e2a7a3f9c8169111a2fd03bd3067393a9d4492d..05700cf7099b19193c84dd5d6074b12dff1974e8 100644 (file)
@@ -1151,11 +1151,17 @@ def main():
     # Build applications...
     failed_apps = {}
     build_succeeded = []
+    # Only build for 12 hours, then stop gracefully
+    endtime = time.time() + 12 * 60 * 60
+    max_build_time_reached = False
     for appid, app in apps.items():
 
         first = True
 
         for build in app.builds:
+            if time.time() > endtime:
+                max_build_time_reached = True
+                break
             if options.server:  # enable watchdog timer
                 timer = threading.Timer(7200, force_halt_build)
                 timer.start()
@@ -1305,6 +1311,10 @@ def main():
             if timer:
                 timer.cancel()  # kill the watchdog timer
 
+        if max_build_time_reached:
+            logging.info("Stopping after global build timeout...")
+            break
+
     for app in build_succeeded:
         logging.info("success: %s" % (app.id))