Commit 6c96e493 authored by kbr@chromium.org's avatar kbr@chromium.org

Second attempt to work around App Engine flakiness by retrying upon URLError

("Connection timed out"). This allowed me to successfully upload a CL I had
been stuck on for a couple of hours.

Manually tested by raising both HTTPError and URLError within this code block
and ensuring both are caught correctly.

BUG=none
TEST=none


Review URL: http://codereview.chromium.org/6304006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@71702 0039d316-1c4b-4281-b951-d872f2087c98
parent ce117f61
......@@ -416,6 +416,14 @@ class AbstractRpcServer(object):
url = e.info()["location"]
else:
raise
except urllib2.URLError, e:
reason = getattr(e, 'reason', None)
if isinstance(reason, str) and reason.find("110") != -1:
# Connection timeout error.
if tries <= 3:
# Try again.
continue
raise
finally:
socket.setdefaulttimeout(old_timeout)
......
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