From 516aeb5ca58eb9bb2b14a99e71dfbc865fe73e86 Mon Sep 17 00:00:00 2001 From: James Braza Date: Thu, 24 Oct 2024 16:06:23 -0700 Subject: [PATCH] Increased retry count for flaky DNS errors --- paperqa/clients/crossref.py | 4 ++-- paperqa/clients/semantic_scholar.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/paperqa/clients/crossref.py b/paperqa/clients/crossref.py index e85581b8..0ea432d6 100644 --- a/paperqa/clients/crossref.py +++ b/paperqa/clients/crossref.py @@ -107,7 +107,7 @@ def get_crossref_mailto() -> str: @retry( retry=retry_if_exception(make_flaky_ssl_error_predicate(CROSSREF_HOST)), before_sleep=before_sleep_log(logger, logging.WARNING), - stop=stop_after_attempt(3), + stop=stop_after_attempt(5), ) async def doi_to_bibtex( doi: str, @@ -239,7 +239,7 @@ async def parse_crossref_to_doc_details( @retry( retry=retry_if_exception(make_flaky_ssl_error_predicate(CROSSREF_HOST)), before_sleep=before_sleep_log(logger, logging.WARNING), - stop=stop_after_attempt(3), + stop=stop_after_attempt(5), ) async def get_doc_details_from_crossref( # noqa: PLR0912 session: aiohttp.ClientSession, diff --git a/paperqa/clients/semantic_scholar.py b/paperqa/clients/semantic_scholar.py index 1a209fb7..5437f5d7 100644 --- a/paperqa/clients/semantic_scholar.py +++ b/paperqa/clients/semantic_scholar.py @@ -113,7 +113,7 @@ def make_url_params( # noqa: PLR0911 @retry( retry=retry_if_exception(make_flaky_ssl_error_predicate(SEMANTIC_SCHOLAR_HOST)), before_sleep=before_sleep_log(logger, logging.WARNING), - stop=stop_after_attempt(3), + stop=stop_after_attempt(5), ) async def _s2_get_with_retrying(url: str, **get_kwargs) -> dict[str, Any]: return await _get_with_retrying( @@ -270,7 +270,7 @@ async def s2_title_search( @retry( retry=retry_if_exception(make_flaky_ssl_error_predicate(SEMANTIC_SCHOLAR_HOST)), before_sleep=before_sleep_log(logger, logging.WARNING), - stop=stop_after_attempt(3), + stop=stop_after_attempt(5), ) async def get_s2_doc_details_from_doi( doi: str | None,