Put a 5 second cap on the delay produced by Scheduler._job_delay().
authorZac Medico <zmedico@gentoo.org>
Wed, 30 Jul 2008 03:33:46 +0000 (03:33 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 30 Jul 2008 03:33:46 +0000 (03:33 -0000)
svn path=/main/trunk/; revision=11277

pym/_emerge/__init__.py

index f69928ee33071331a15655749aece57f8afd6e02..e418f0353c21daf914c970c5a05b32f2c1658c90 100644 (file)
@@ -8862,6 +8862,7 @@ class Scheduler(PollScheduler):
                # The load average takes some time to respond when new
                # jobs are added, so we need to limit the rate of adding
                # new jobs.
+               self._job_delay_max = 5
                self._job_delay_factor = 0.5
                self._previous_job_start_time = None
 
@@ -9690,8 +9691,10 @@ class Scheduler(PollScheduler):
 
                        current_time = time.time()
 
-                       if current_time - self._previous_job_start_time < \
-                               self._job_delay_factor * self._jobs:
+                       delay = self._job_delay_factor * self._jobs
+                       if delay > self._job_delay_max:
+                               delay = self._job_delay_max
+                       if (current_time - self._previous_job_start_time) < delay:
                                return True
 
                return False