Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 762922: improve signing client retry logic. r=bhearsum

We now try different URLs per file instead of waiting for a file to
retry/timeout many times against one server.
  • Loading branch information...
commit 8f2a9b1c8294e2b4ed1f8cb8a2a87aec82af3920 1 parent d791947
@catlee catlee authored
Showing with 14 additions and 15 deletions.
  1. +9 −3 lib/python/signing/client.py
  2. +5 −12 release/signing/signtool.py
View
12 lib/python/signing/client.py
@@ -14,7 +14,7 @@ def getfile(baseurl, filehash, format_):
r = urllib2.Request(url)
return urllib2.urlopen(r)
-def remote_signfile(options, url, filename, fmt, token, dest=None):
+def remote_signfile(options, urls, filename, fmt, token, dest=None):
filehash = sha1sum(filename)
if dest is None:
dest = filename
@@ -57,8 +57,6 @@ def remote_signfile(options, url, filename, fmt, token, dest=None):
check_call(cmd, shell=True)
return True
- log.info("%s: processing %s on %s", filehash, filename, url)
-
errors = 0
pendings = 0
max_errors = 20
@@ -72,6 +70,8 @@ def remote_signfile(options, url, filename, fmt, token, dest=None):
return False
# Try to get a previously signed copy of this file
try:
+ url = urls[0]
+ log.info("%s: processing %s on %s", filehash, filename, url)
req = getfile(url, filehash, fmt)
headers = req.info()
responsehash = headers['X-SHA1-Digest']
@@ -143,11 +143,17 @@ def remote_signfile(options, url, filename, fmt, token, dest=None):
except (urllib2.URLError, socket.error, httplib.BadStatusLine):
# Try again in a little while
log.info("%s: connection error; trying again soon", filehash)
+ # Move the current url to the back
+ urls.pop(0)
+ urls.append(url)
time.sleep(1)
continue
except (urllib2.URLError, socket.error):
# Try again in a little while
log.info("%s: connection error; trying again soon", filehash)
+ # Move the current url to the back
+ urls.pop(0)
+ urls.append(url)
time.sleep(1)
errors += 1
continue
View
17 release/signing/signtool.py
@@ -163,19 +163,12 @@ def main():
if fmt == 'signcode' and is_authenticode_signed(f):
log.info("Skipping %s because it looks like it's already signed", f)
continue
- for url in urls[:]:
- if options.output_dir:
- dest = os.path.join(options.output_dir, os.path.basename(f))
- else:
- dest = None
-
- if remote_signfile(options, url, f, fmt, token, dest):
- break
- elif len(urls) > 1:
- # Move the url to the end of the list
- urls.remove(url)
- urls.append(url)
+ if options.output_dir:
+ dest = os.path.join(options.output_dir, os.path.basename(f))
else:
+ dest = None
+
+ if not remote_signfile(options, urls, f, fmt, token, dest):
log.error("Failed to sign %s with %s", f, fmt)
sys.exit(1)
Please sign in to comment.
Something went wrong with that request. Please try again.