3333from .candidate import Candidate
3434from .constraints import Constraints
3535from .extras_provider import ExtrasProvider
36+ from .http_retry import RETRYABLE_EXCEPTIONS , retry_on_exception
3637from .request_session import session
3738from .requirements_file import RequirementType
3839
@@ -760,6 +761,12 @@ def __init__(
760761 def cache_key (self ) -> str :
761762 return f"{ self .organization } /{ self .repo } "
762763
764+ @retry_on_exception (
765+ exceptions = RETRYABLE_EXCEPTIONS ,
766+ max_attempts = 5 ,
767+ backoff_factor = 1.5 ,
768+ max_backoff = 120.0 ,
769+ )
763770 def _find_tags (
764771 self ,
765772 identifier : str ,
@@ -773,17 +780,8 @@ def _find_tags(
773780
774781 nexturl = self .api_url .format (self = self )
775782 while nexturl :
776- try :
777- resp = session .get (nexturl , headers = headers )
778- resp .raise_for_status ()
779- except Exception as e :
780- logger .error (
781- "%s: Failed to fetch GitHub tags from %s: %s" ,
782- identifier ,
783- nexturl ,
784- e ,
785- )
786- raise
783+ resp = session .get (nexturl , headers = headers )
784+ resp .raise_for_status ()
787785
788786 for entry in resp .json ():
789787 name = entry ["name" ]
@@ -834,23 +832,20 @@ def __init__(
834832 def cache_key (self ) -> str :
835833 return f"{ self .server_url } /{ self .project_path } "
836834
835+ @retry_on_exception (
836+ exceptions = RETRYABLE_EXCEPTIONS ,
837+ max_attempts = 5 ,
838+ backoff_factor = 1.5 ,
839+ max_backoff = 120.0 ,
840+ )
837841 def _find_tags (
838842 self ,
839843 identifier : str ,
840844 ) -> Iterable [tuple [str , Version ]]:
841845 nexturl : str = self .api_url
842846 while nexturl :
843- try :
844- resp : Response = session .get (nexturl )
845- resp .raise_for_status ()
846- except Exception as e :
847- logger .error (
848- "%s: Failed to fetch GitLab tags from %s: %s" ,
849- identifier ,
850- nexturl ,
851- e ,
852- )
853- raise
847+ resp : Response = session .get (nexturl )
848+ resp .raise_for_status ()
854849 for entry in resp .json ():
855850 name = entry ["name" ]
856851 version = self ._match_function (identifier , name )
0 commit comments