Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Honaker <[email protected]>
  • Loading branch information
HonakerM committed Sep 6, 2024
1 parent dc13b13 commit 9ce0bd8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions oper8/watch_manager/python_watch_manager/threads/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ def run(self):
# Check for leadership and shutdown at the start
list_resource_version = 0
while True:
if not self.check_preconditions():
log.debug("Checking preconditions failed. Shuting down")
return

try:
if not self.check_preconditions():
log.debug("Checking preconditions failed. Shutting down")
return

for event in self.deploy_manager.watch_objects(
self.kind,
self.api_version,
Expand All @@ -129,7 +129,7 @@ def run(self):
):
# Validate leadership on each event
if not self.check_preconditions():
log.debug("Checking preconditions failed. Shuting down")
log.debug("Checking preconditions failed. Shutting down")
return

resource = event.resource
Expand Down Expand Up @@ -183,7 +183,11 @@ def run(self):
)
sys.exit(1)

self.wait_on_precondition(self.retry_delay.total_seconds())
if self.wait_on_precondition(self.retry_delay.total_seconds()):
log.debug(
"Checking preconditions failed during retry. Shutting down"
)
return
self.attempts_left = self.attempts_left - 1
log.info("Restarting watch with %d attempts left", self.attempts_left)

Expand Down

0 comments on commit 9ce0bd8

Please sign in to comment.