Skip to content

Commit

Permalink
Merge pull request #3 from ScilifelabDataCentre/develop
Browse files Browse the repository at this point in the history
catching ApiException
  • Loading branch information
sandstromviktor authored Apr 22, 2024
2 parents 6335764 + 393f49b commit 0fddfac
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 0fddfac

Please sign in to comment.