[Yum-devel] [PATCH] Rename the mirror's connection limit to max_mirror_connections.

Zdeněk Pavlas zpavlas at redhat.com
Thu Aug 16 15:51:03 UTC 2012


The mirror's 'kwargs' hash is used to update the grab request,
and it was overriding the global limit.  Using different names
is also much clearer.
---
 urlgrabber/grabber.py |    5 +++--
 urlgrabber/mirror.py  |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index bdcdfe3..231ed64 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -954,6 +954,7 @@ class URLGrabberOptions:
         self.async = None # blocking by default
         self.mirror_group = None
         self.max_connections = 5
+        self.max_mirror_connections = 2
         self.timedhosts = None
         self.half_life = 30*24*60*60 # 30 days
         self.default_speed = 1e6 # 1 MBit
@@ -2243,8 +2244,8 @@ def parallel_wait(meter = 'text'):
 
                 # update the current mirror and limit
                 key = best['mirror']
-                limit = best.get('kwargs', {}).get('max_connections', 2)
-                opts.async = key, limit
+                limit = best.get('kwargs', {}).get('max_mirror_connections')
+                opts.async = key, limit or opts.max_mirror_connections
 
                 # update URL and proxy
                 url = mg._join_url(key, opts.relative_url)
diff --git a/urlgrabber/mirror.py b/urlgrabber/mirror.py
index ac78b34..7c16a6a 100644
--- a/urlgrabber/mirror.py
+++ b/urlgrabber/mirror.py
@@ -76,7 +76,7 @@ CUSTOMIZATION
        'grabber' is omitted, the default grabber will be used.  If
        kwargs are omitted, then (duh) they will not be used.
 
-       kwarg 'max_connections' is used to store the max connection
+       kwarg 'max_mirror_connections' is used to store the connection
        limit of this mirror.
 
     3) Pass keyword arguments when instantiating the mirror group.
-- 
1.7.4.4



More information about the Yum-devel mailing list