summaryrefslogtreecommitdiff
path: root/mirrors
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-11 20:49:04 -0500
committerDan McGee <dan@archlinux.org>2010-10-11 20:49:04 -0500
commite2612ab3f6963df37f9ca2542718c5712966ca29 (patch)
tree88e5aa756876a846e2ed43344a342ec25fd1a61e /mirrors
parent8e186efb2a4676717e92779a7578ec48231646b1 (diff)
mirrorcheck: catch and handle another socket timeout case
We were seeing processes hang on the Arch server. It looks like there are ways for socket.timeout to come out of the main check code, so add another except block to catch this case. In addition, make sure we always call task_done() even on failures so processes eventually die. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/management/commands/mirrorcheck.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py
index 210505fa..4f677a20 100644
--- a/mirrors/management/commands/mirrorcheck.py
+++ b/mirrors/management/commands/mirrorcheck.py
@@ -56,7 +56,8 @@ class Command(NoArgsCommand):
def parse_rfc3339_datetime(time):
# '2010-09-02 11:05:06+02:00'
- m = re.match('^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})([-+])(\d{2}):(\d{2})', time)
+ m = re.match('^(\d{4})-(\d{2})-(\d{2}) '
+ '(\d{2}):(\d{2}):(\d{2})([-+])(\d{2}):(\d{2})', time)
if m:
vals = m.groups()
parsed = datetime(int(vals[0]), int(vals[1]), int(vals[2]),
@@ -120,6 +121,10 @@ def check_mirror_url(mirror_url):
elif isinstance(e.reason, socket.error):
log.error = e.reason.args[1]
logger.debug("failed: %s, %s" % (url, log.error))
+ except socket.timeout, e:
+ log.is_success = false
+ log.error = "Connection timed out."
+ logger.debug("failed: %s, %s" % (url, log.error))
log.save()
return log
@@ -128,8 +133,10 @@ def mirror_url_worker(queue):
while True:
try:
item = queue.get(block=False)
- check_mirror_url(item)
- queue.task_done()
+ try:
+ check_mirror_url(item)
+ finally:
+ queue.task_done()
except Empty:
return 0