diff --git a/gestalt/vault.py b/gestalt/vault.py index 9ee1575..cc38c82 100644 --- a/gestalt/vault.py +++ b/gestalt/vault.py @@ -31,6 +31,7 @@ def __init__(self, with role and jwt string from kubernetes """ self._scheme: str = scheme + self._run_worker = True self.dynamic_token_queue: Queue[Tuple[str, str, str]] = Queue() self.kubes_token_queue: Queue[Tuple[str, str, str]] = Queue() @@ -77,6 +78,12 @@ def __init__(self, args=(self.kubes_token_queue, )) kubernetes_ttl_renew.start() + def stop(self) -> None: + self._run_worker = False + + def __del__(self) -> None: + self.stop() + @retry(RuntimeError, delay=3, tries=3) # type: ignore def get( self, @@ -159,7 +166,7 @@ def worker(self, token_queue: Queue) -> None: # type: ignore """ try: - while True: + while self._run_worker: if not token_queue.empty(): token_type, token_id, token_duration = token = token_queue.get( ) diff --git a/setup.py b/setup.py index 9fffb7d..bce283c 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.2', + version='3.3.3', description='A sensible configuration library for Python', long_description=readme(), long_description_content_type="text/markdown",