Skip to content

Commit

Permalink
catching ApiException
Browse files Browse the repository at this point in the history
  • Loading branch information
sandstromviktor committed Apr 22, 2024
1 parent 6335764 commit 393f49b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions serve_event_listener/event_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import requests
import urllib3
from kubernetes import client, config, watch
from kubernetes.client.exceptions import ApiException
from status_data import StatusData
from status_queue import StatusQueue

Expand Down Expand Up @@ -128,6 +129,12 @@ def listen(self) -> None:
time.sleep(retry_delay)
retries += 1

except ApiException as e:
logger.error(f"ApiException occurred: {e!r}")
logger.info(f"Retrying in {retry_delay} seconds...")
time.sleep(retry_delay)
retries += 1

except Exception as e:
logger.error("Event listener exception occurred:")
logger.exception(e)
Expand Down

0 comments on commit 393f49b

Please sign in to comment.