[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.45-102-g4c48ac2

Andreas Beckmann debian at abeckmann.de
Fri Aug 3 08:51:47 UTC 2012


The following commit has been merged in the develop branch:
commit 1dd6ebcf399895083132c0c9e6fdcf4f68f3529d
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Fri Jul 20 13:11:24 2012 +0200

    p-s: add _recycle_wait_until timeout counter
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/piuparts-slave.py b/piuparts-slave.py
index 458588c..a5baf06 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -292,6 +292,7 @@ class Section:
         self._config.read(CONFIG_FILE)
         self._error_wait_until = 0
         self._idle_wait_until = 0
+        self._recycle_wait_until = 0
         self._slave_directory = os.path.abspath(self._config["slave-directory"])
         if not os.path.exists(self._slave_directory):
             os.makedirs(self._slave_directory)
@@ -347,12 +348,14 @@ class Section:
     def precedence(self):
         return int(self._config["precedence"])
 
-    def sleep_until(self):
+    def sleep_until(self, recycle=False):
+        if recycle:
+            return max(self._error_wait_until, self._recycle_wait_until)
         return max(self._error_wait_until, self._idle_wait_until)
 
 
-    def run(self, precedence=None):
-        if time.time() < self.sleep_until():
+    def run(self, precedence=None, recycle=False):
+        if time.time() < self.sleep_until(recycle=recycle):
             return 0
 
         do_processing = not got_sighup and \
@@ -393,6 +396,8 @@ class Section:
                     if do_processing:
                         if not self._slave.get_reserved():
                             self._idle_wait_until = time.time() + int(self._config["idle-sleep"])
+                            if recycle:
+                                self._recycle_wait_until = self._idle_wait_until + 3600
                         else:
                             return self._process()
             finally:
@@ -498,6 +503,7 @@ class Section:
             self._slave.forget_reserved(package_name, version)
             if interrupted:
                 break
+        self._recycle_wait_until = time.time()
         self._talk_to_master(unreserve=interrupted)
         if interrupted:
             raise KeyboardInterrupt

-- 
piuparts git repository



More information about the Piuparts-commits mailing list