diff -Nur plague-0.4.4.1-orig/server/ArchJob.py plague-0.4.4.1/server/ArchJob.py --- plague-0.4.4.1-orig/server/ArchJob.py 2006-02-23 20:10:30.000000000 +0100 +++ plague-0.4.4.1/server/ArchJob.py 2008-01-04 05:47:17.000000000 +0100 @@ -198,6 +198,7 @@ def dl_callback(self, status, cb_data): url = cb_data + self.builder._fwd_dl_callback(self) self._download_lock.acquire() dl_dict = self._downloads[url] if status == 'done': diff -Nur plague-0.4.4.1-orig/server/Builder.py plague-0.4.4.1/server/Builder.py --- plague-0.4.4.1-orig/server/Builder.py 2006-02-19 07:26:19.000000000 +0100 +++ plague-0.4.4.1/server/Builder.py 2008-01-04 05:48:29.000000000 +0100 @@ -86,6 +86,9 @@ self._when_died = 0 self._server_cfg = cfg + self._archjob_dl_lock = threading.Lock() + self._archjob_dl_queue = [] + certs = {} if self._server_cfg.get_bool("Builders", "use_ssl"): certs['key_and_cert'] = self._server_cfg.get_str("SSL", "server_key_and_cert") @@ -325,6 +328,11 @@ EmailUtils.email_result(sender, addr, msg, subject) self._when_died = 0 + def _fwd_dl_callback(self,job): + self._archjob_dl_lock.acquire() + self._archjob_dl_queue.append(job) + self._archjob_dl_lock.release() + def run(self): DebugUtils.registerThreadName(self) while not self._stop: @@ -356,7 +364,28 @@ self._server_lock.release() - time.sleep(20) + last_time = time.time() + while (time.time() <= last_time+20): + + # Process archjobs which had download callbacks, + # so next file download is started sooner. + self._archjob_dl_lock.acquire() + dl_jobs = self._archjob_dl_queue + self._archjob_dl_queue = [] + self._archjob_dl_lock.release() + if len(dl_jobs): + status_change = False + self._server_lock.acquire() + for j in dl_jobs: + old_status = j.get_status() + j.process() + if old_status != j.get_status(): + status_change = True + self._server_lock.release() + if status_change: + break + + time.sleep(1) def available(self): """