From ee58472aab9fda7c3eb37eb78337155088cfd008 Mon Sep 17 00:00:00 2001 From: Alex Dunn Date: Thu, 3 Aug 2023 11:11:12 -0700 Subject: [PATCH 1/2] bump http retries to 6, per sjoshi request --- src/pds/registrysweepers/utils/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pds/registrysweepers/utils/__init__.py b/src/pds/registrysweepers/utils/__init__.py index c3fe4e4..e558dee 100644 --- a/src/pds/registrysweepers/utils/__init__.py +++ b/src/pds/registrysweepers/utils/__init__.py @@ -126,7 +126,7 @@ def query_registry_db( requests.get, fargs=[urllib.parse.urljoin(host.url, path)], fkwargs={"auth": (host.username, host.password), "verify": host.verify, "json": req_content}, - tries=4, + tries=6, delay=2, backoff=2, logger=log, @@ -171,7 +171,7 @@ def query_registry_db( requests.delete, fargs=[urllib.parse.urljoin(host.url, path)], fkwargs={"auth": (host.username, host.password), "verify": host.verify}, - tries=4, + tries=6, delay=2, backoff=2, logger=log, @@ -245,7 +245,7 @@ def write_updated_docs(host: Host, ids_and_updates: Mapping[str, Dict], index_na _write_bulk_updates_chunk(host, index_name, bulk_updates_buffer) -@retry(exceptions=(HTTPError, RuntimeError), tries=4, delay=2, backoff=2, logger=log) +@retry(exceptions=(HTTPError, RuntimeError), tries=6, delay=2, backoff=2, logger=log) def _write_bulk_updates_chunk(host: Host, index_name: str, bulk_updates: Iterable[str]): headers = {"Content-Type": "application/x-ndjson"} path = f"{index_name}/_bulk" From 2baa66fa3cd04fa7e2f1ddd5f03cb96359541360 Mon Sep 17 00:00:00 2001 From: Alex Dunn Date: Thu, 3 Aug 2023 11:11:52 -0700 Subject: [PATCH 2/2] fix HTTPError import --- src/pds/registrysweepers/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pds/registrysweepers/utils/__init__.py b/src/pds/registrysweepers/utils/__init__.py index e558dee..d89eec1 100644 --- a/src/pds/registrysweepers/utils/__init__.py +++ b/src/pds/registrysweepers/utils/__init__.py @@ -15,9 +15,9 @@ from typing import Mapping from typing import Optional from typing import Union -from urllib.error import HTTPError import requests +from requests.exceptions import HTTPError from retry import retry from retry.api import retry_call