Skip to content

Commit

Permalink
robustcheckout: handle socket.timeout exceptions and retry (bug 18239…
Browse files Browse the repository at this point in the history
…92) r=sheehan

Differential Revision: https://phabricator.services.mozilla.com/D173300

--HG--
extra : moz-landing-system : lando
  • Loading branch information
jcristau committed Mar 22, 2023
1 parent a43349c commit e439b2c
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions hgext/robustcheckout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ def handlepullerror(e):
pycompat.bytestr(str(e.reason)),
)
)
elif isinstance(e, socket.timeout):
ui.warn(b"socket timeout\n")
handlenetworkfailure()
return True
else:
ui.warn(
b"unhandled exception during network operation; type: %s; "
Expand All @@ -529,7 +533,12 @@ def handlepullerror(e):
rootnode = peerlookup(clonepeer, b"0")
except error.RepoLookupError:
raise error.Abort(b"unable to resolve root revision from clone " b"source")
except (error.Abort, ssl.SSLError, urllibcompat.urlerr.urlerror) as e:
except (
error.Abort,
ssl.SSLError,
urllibcompat.urlerr.urlerror,
socket.timeout,
) as e:
if handlepullerror(e):
return callself()
raise
Expand Down Expand Up @@ -622,7 +631,12 @@ def handlepullerror(e):
shareopts=shareopts,
stream=True,
)
except (error.Abort, ssl.SSLError, urllibcompat.urlerr.urlerror) as e:
except (
error.Abort,
ssl.SSLError,
urllibcompat.urlerr.urlerror,
socket.timeout,
) as e:
if handlepullerror(e):
return callself()
raise
Expand Down Expand Up @@ -690,7 +704,12 @@ def handlepullerror(e):
pullop = exchange.pull(repo, remote, heads=pullrevs)
if not pullop.rheads:
raise error.Abort(b"unable to pull requested revision")
except (error.Abort, ssl.SSLError, urllibcompat.urlerr.urlerror) as e:
except (
error.Abort,
ssl.SSLError,
urllibcompat.urlerr.urlerror,
socket.timeout,
) as e:
if handlepullerror(e):
return callself()
raise
Expand Down

0 comments on commit e439b2c

Please sign in to comment.