r288 - in branches/rewrite: . src

Otavio Salvador partial-mirror-devel@lists.alioth.debian.org
Wed, 10 Nov 2004 17:18:55 -0700


Author: otavio
Date: Wed Nov 10 17:18:54 2004
New Revision: 288

Modified:
   branches/rewrite/   (props changed)
   branches/rewrite/src/Download.py
Log:
 r217@nurf:  otavio | 2004-11-11T00:19:07.422064Z
 Handle when doesn't have more work todo and remove debuging code.


Modified: branches/rewrite/src/Download.py
==============================================================================
--- branches/rewrite/src/Download.py	(original)
+++ branches/rewrite/src/Download.py	Wed Nov 10 17:18:54 2004
@@ -50,7 +50,7 @@
             try:
                 url, filename = Download.queue.get_nowait()
             except Empty:
-                pass
+                return
                 
             f = open(filename, "wb")
             curl = pycurl.Curl()
@@ -80,8 +80,8 @@
             curl.close()
             try:
                 f.close()
-            except IOError, e:
-                print e
+            except IOError:
+                pass
 
             # Store counter information about it
             self._Lock.acquire()
@@ -109,3 +109,8 @@
                 t = DownloadThread()
                 self.fetchers.append(t)
                 t.start()
+
+        # Check if any thread is stoped so reuse it.
+        for f in self.fetchers:
+            if not f.isAlive():
+                f.start()