Skip to content

Commit 9b640cc

Browse files
committed
mercurial: take into account more cases of mercurial failures for retry.
1 parent 038cc46 commit 9b640cc

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

libmozevent/mercurial.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ async def run(self):
335335
# Find the repository from the diff and trigger the build on it
336336
repository = self.repositories.get(build.repo_phid)
337337
if repository is not None:
338-
339338
result = await self.handle_build(repository, build)
340339
if result:
341340
await self.bus.send(self.queue_phabricator, result)
@@ -454,7 +453,22 @@ async def handle_build(self, repository, build):
454453
if isinstance(error_log, bytes):
455454
error_log = error_log.decode("utf-8")
456455

457-
if "push failed on remote" in error_log.lower():
456+
def is_eligible_for_retry(error):
457+
'''
458+
Given a Mercurial error message, if it's like on of our cached
459+
ones then it's eligible for retry
460+
'''
461+
eligible_errors = [
462+
"push failed on remote",
463+
"stream ended unexpectedly",
464+
"error: EOF occurred in violation of protocol"
465+
]
466+
for eligible_message in eligible_errors:
467+
if eligible_message in error_log:
468+
return True
469+
return False
470+
471+
if (is_eligible_for_retry(error_log.lower())):
458472
build.retries += 1
459473
# Ensure try is opened
460474
await self.wait_try_available()

0 commit comments

Comments
 (0)