[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.44-650-g8d79273

Andreas Beckmann debian at abeckmann.de
Sun Jun 3 09:04:10 UTC 2012


The following commit has been merged in the develop branch:
commit 8d7927387fede3557ac5b5cb3706e57c90af1035
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Sat Jun 2 21:17:26 2012 +0200

    p-s: sleep until a section can be retried
    
    If idle, sleep until the next section can be tried, but at least 1 minute.
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/debian/changelog b/debian/changelog
index fffdeac..b34bc49 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -77,6 +77,7 @@ piuparts (0.45) UNRELEASED; urgency=low
       non-circular dependencies are satisfied.
   * piuparts-slave.py:
     - Randomize waiting time (between 60 and 180 seconds) if master is busy.
+    - Sleep until the next section can be tried, but at least 1 minute.
   * piuparts-report.py:
     - Exclude obsolete states from generated report.
     - Establish packagesdb working directory in Section.
diff --git a/piuparts-slave.py b/piuparts-slave.py
index 65d2da8..632ee23 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -647,9 +647,12 @@ def main():
                     precedence = section.precedence()
 
         if test_count == 0:
-            sleep_time = int(global_config["idle-sleep"])
-            logging.info("Nothing to do, sleeping for %d seconds." % sleep_time)
-            time.sleep( sleep_time )
+            now = time.time()
+            sleep_until = min([now + int(global_config["idle-sleep"])] + [section._sleep_until for section in sections])
+            if (sleep_until > now):
+                to_sleep = max(60, sleep_until - now)
+                logging.info("Nothing to do, sleeping for %d seconds." % to_sleep)
+                time.sleep(to_sleep)
 
 
 if __name__ == "__main__":

-- 
piuparts git repository



More information about the Piuparts-commits mailing list