Skip to content

Commit

Permalink
BUG: Fix bug with _watch_resource_loop
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yetisage committed Nov 24, 2024
1 parent b31ff68 commit c4920ec
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c4920ec

Please sign in to comment.