From c4920eced20918d7cca79a523212a19d4ca5db73 Mon Sep 17 00:00:00 2001 From: yetisage Date: Sun, 24 Nov 2024 16:17:04 +0100 Subject: [PATCH] BUG: Fix bug with _watch_resource_loop Add sleep to ApiException except to reduce watch requests, when receiving a non 500 status code. This avoids spamming the Kubernetes API with attempted watch requests if for example the API returns a 4xx status code. --- src/resources.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/resources.py b/src/resources.py index ca3533f1..72be4334 100755 --- a/src/resources.py +++ b/src/resources.py @@ -373,6 +373,7 @@ def _watch_resource_loop(mode, *args): except ApiException as e: if e.status != 500: logger.error(f"ApiException when calling kubernetes: {e}\n") + sleep(int(os.getenv("ERROR_THROTTLE_SLEEP", 5))) else: raise except ProtocolError as e: