Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#minor Remove unnecessary sleep before each watch cycle #326

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,6 @@ def _watch_resource_iterator(label, label_value, target_folder, request_url, req
def _watch_resource_loop(mode, *args):
while True:
try:
# Always wait to slow down the loop in case of exceptions
sleep(int(os.getenv("ERROR_THROTTLE_SLEEP", 5)))
if mode == "SLEEP":
list_resources(*args)
sleep(int(os.getenv("SLEEP_TIME", 60)))
Expand All @@ -379,11 +377,14 @@ def _watch_resource_loop(mode, *args):
raise
except ProtocolError as e:
logger.error(f"ProtocolError when calling kubernetes: {e}\n")
sleep(int(os.getenv("ERROR_THROTTLE_SLEEP", 5)))
except MaxRetryError as e:
logger.error(f"MaxRetryError when calling kubernetes: {e}\n")
sleep(int(os.getenv("ERROR_THROTTLE_SLEEP", 5)))
except Exception as e:
logger.error(f"Received unknown exception: {e}\n")
traceback.print_exc()
sleep(int(os.getenv("ERROR_THROTTLE_SLEEP", 5)))


def watch_for_changes(mode, label, label_value, target_folder, request_url, request_method, request_payload,
Expand Down
Loading