From b08e25598b697d78d21e184cf43ebff5823a87dd Mon Sep 17 00:00:00 2001 From: Tucker Joseph Date: Fri, 8 Dec 2023 11:55:05 -0500 Subject: [PATCH] retry timeout errors in vault (#40) * retry timeout errors in vault * fix lint * i will not be defeated by a linter --- gestalt/vault.py | 5 +++-- setup.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gestalt/vault.py b/gestalt/vault.py index cc38c82..ae8f843 100644 --- a/gestalt/vault.py +++ b/gestalt/vault.py @@ -2,6 +2,7 @@ from time import sleep from gestalt.provider import Provider import requests +from requests.exceptions import Timeout from jsonpath_ng import parse # type: ignore from typing import Optional, Tuple, Any, Dict, Union, List import hvac # type: ignore @@ -12,7 +13,7 @@ class Vault(Provider): - @retry(exceptions=RuntimeError, delay=2, tries=5) # type: ignore + @retry((RuntimeError, Timeout), delay=2, tries=5) # type: ignore def __init__(self, cert: Optional[Tuple[str, str]] = None, role: Optional[str] = None, @@ -84,7 +85,7 @@ def stop(self) -> None: def __del__(self) -> None: self.stop() - @retry(RuntimeError, delay=3, tries=3) # type: ignore + @retry((RuntimeError, Timeout), delay=3, tries=3) # type: ignore def get( self, key: str, diff --git a/setup.py b/setup.py index 99cb925..d84dd0f 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ def readme(): reqs_list = list(map(lambda x: x.rstrip(), reqs)) setup(name='gestalt-cfg', - version='3.3.4', + version='3.3.5', description='A sensible configuration library for Python', long_description=readme(), long_description_content_type="text/markdown",