1 |
diff -Nur plague-0.4.4.1-orig/server/ArchJob.py plague-0.4.4.1/server/ArchJob.py |
2 |
--- plague-0.4.4.1-orig/server/ArchJob.py 2006-02-23 20:10:30.000000000 +0100 |
3 |
+++ plague-0.4.4.1/server/ArchJob.py 2008-01-04 05:47:17.000000000 +0100 |
4 |
@@ -198,6 +198,7 @@ |
5 |
|
6 |
def dl_callback(self, status, cb_data): |
7 |
url = cb_data |
8 |
+ self.builder._fwd_dl_callback(self) |
9 |
self._download_lock.acquire() |
10 |
dl_dict = self._downloads[url] |
11 |
if status == 'done': |
12 |
diff -Nur plague-0.4.4.1-orig/server/Builder.py plague-0.4.4.1/server/Builder.py |
13 |
--- plague-0.4.4.1-orig/server/Builder.py 2006-02-19 07:26:19.000000000 +0100 |
14 |
+++ plague-0.4.4.1/server/Builder.py 2008-01-04 05:48:29.000000000 +0100 |
15 |
@@ -86,6 +86,9 @@ |
16 |
self._when_died = 0 |
17 |
self._server_cfg = cfg |
18 |
|
19 |
+ self._archjob_dl_lock = threading.Lock() |
20 |
+ self._archjob_dl_queue = [] |
21 |
+ |
22 |
certs = {} |
23 |
if self._server_cfg.get_bool("Builders", "use_ssl"): |
24 |
certs['key_and_cert'] = self._server_cfg.get_str("SSL", "server_key_and_cert") |
25 |
@@ -325,6 +328,11 @@ |
26 |
EmailUtils.email_result(sender, addr, msg, subject) |
27 |
self._when_died = 0 |
28 |
|
29 |
+ def _fwd_dl_callback(self,job): |
30 |
+ self._archjob_dl_lock.acquire() |
31 |
+ self._archjob_dl_queue.append(job) |
32 |
+ self._archjob_dl_lock.release() |
33 |
+ |
34 |
def run(self): |
35 |
DebugUtils.registerThreadName(self) |
36 |
while not self._stop: |
37 |
@@ -356,7 +364,28 @@ |
38 |
|
39 |
self._server_lock.release() |
40 |
|
41 |
- time.sleep(20) |
42 |
+ last_time = time.time() |
43 |
+ while (time.time() <= last_time+20): |
44 |
+ |
45 |
+ # Process archjobs which had download callbacks, |
46 |
+ # so next file download is started sooner. |
47 |
+ self._archjob_dl_lock.acquire() |
48 |
+ dl_jobs = self._archjob_dl_queue |
49 |
+ self._archjob_dl_queue = [] |
50 |
+ self._archjob_dl_lock.release() |
51 |
+ if len(dl_jobs): |
52 |
+ status_change = False |
53 |
+ self._server_lock.acquire() |
54 |
+ for j in dl_jobs: |
55 |
+ old_status = j.get_status() |
56 |
+ j.process() |
57 |
+ if old_status != j.get_status(): |
58 |
+ status_change = True |
59 |
+ self._server_lock.release() |
60 |
+ if status_change: |
61 |
+ break |
62 |
+ |
63 |
+ time.sleep(1) |
64 |
|
65 |
def available(self): |
66 |
""" |