Commit 36c009d4 authored by Russ Cox's avatar Russ Cox

codereview: only retry on HTTP 500 error

R=r
CC=golang-dev
https://golang.org/cl/4353047
parent 492039ae
...@@ -1741,7 +1741,7 @@ def DownloadCL(ui, repo, clname): ...@@ -1741,7 +1741,7 @@ def DownloadCL(ui, repo, clname):
set_status("downloading CL " + clname) set_status("downloading CL " + clname)
cl, err = LoadCL(ui, repo, clname) cl, err = LoadCL(ui, repo, clname)
if err != "": if err != "":
return None, None, "error loading CL %s: %s" % (clname, ExceptionDetail()) return None, None, "error loading CL %s: %s" % (clname, err)
# Grab RSS feed to learn about CL # Grab RSS feed to learn about CL
feed = XMLGet(ui, "/rss/issue/" + clname) feed = XMLGet(ui, "/rss/issue/" + clname)
...@@ -1800,7 +1800,7 @@ def MySend(request_path, payload=None, ...@@ -1800,7 +1800,7 @@ def MySend(request_path, payload=None,
try: try:
return MySend1(request_path, payload, content_type, timeout, force_auth, **kwargs) return MySend1(request_path, payload, content_type, timeout, force_auth, **kwargs)
except Exception, e: except Exception, e:
if type(e) == urllib2.HTTPError and e.code == 403: # forbidden, it happens if type(e) != urllib2.HTTPError or e.code != 500: # only retry on HTTP 500 error
raise raise
print >>sys.stderr, "Loading "+request_path+": "+ExceptionDetail()+"; trying again in 2 seconds." print >>sys.stderr, "Loading "+request_path+": "+ExceptionDetail()+"; trying again in 2 seconds."
time.sleep(2) time.sleep(2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment