@@ -313,6 +313,15 @@ class MercurialWorker(object):
313
313
Mercurial worker maintaining several local clones
314
314
"""
315
315
316
+ ELIGIBLE_RETRY_ERRORS = [
317
+ error .lower ()
318
+ for error in [
319
+ "push failed on remote" ,
320
+ "stream ended unexpectedly" ,
321
+ "error: EOF occurred in violation of protocol" ,
322
+ ]
323
+ ]
324
+
316
325
def __init__ (self , queue_name , queue_phabricator , repositories , skippable_files = []):
317
326
assert all (map (lambda r : isinstance (r , Repository ), repositories .values ()))
318
327
self .queue_name = queue_name
@@ -401,15 +410,10 @@ def is_eligible_for_retry(self, error):
401
410
Given a Mercurial error message, if it's an error likely due to a
402
411
temporary connection problem, consider it as eligible for retry.
403
412
"""
404
- eligible_errors = [
405
- "push failed on remote" ,
406
- "stream ended unexpectedly" ,
407
- "error: EOF occurred in violation of protocol" ,
408
- ]
409
- for eligible_message in eligible_errors :
410
- if eligible_message in error :
411
- return True
412
- return False
413
+ error = error .lower ()
414
+ return any (
415
+ eligible_message in error for eligible_message in self .ELIGIBLE_RETRY_ERRORS
416
+ )
413
417
414
418
async def handle_build (self , repository , build ):
415
419
"""
@@ -471,7 +475,7 @@ async def handle_build(self, repository, build):
471
475
if isinstance (error_log , bytes ):
472
476
error_log = error_log .decode ("utf-8" )
473
477
474
- if self .is_eligible_for_retry (error_log . lower () ):
478
+ if self .is_eligible_for_retry (error_log ):
475
479
build .retries += 1
476
480
# Ensure try is opened
477
481
await self .wait_try_available ()
0 commit comments