Skip to content

Commit

Permalink
Add wait for plugin backoff
Browse files Browse the repository at this point in the history
  • Loading branch information
1maple1 committed Aug 20, 2024
1 parent 3275ec9 commit 4cf67a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions brewtils/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,13 @@ def get_system_dependency(self, require, timeout=300):
and any("RUNNING" == instance.status for instance in system.instances)
):
return system
self._wait()
self.logger.error(
f"Waiting {wait_time:.1f} seconds before next attempt for {self._system} "
f"dependency for {require}"
)
timeout = timeout - wait_time
wait_time = min(wait_time * 2, 30)
self._wait(wait_time)

raise PluginValidationError(
f"Failed to resolve {self._system} dependency for {require}"
Expand Down Expand Up @@ -688,12 +688,13 @@ def _start(self):
self._instance.id, new_status="RUNNING"
)

def _wait(self):
def _wait(self, timeout):
"""Handle wait request"""
# Set the status to wait
self._instance = self._ez_client.update_instance(
self._instance.id, new_status="AWAITING_SYSTEM"
)
self._shutdown_event.wait(timeout)

def _stop(self):
"""Handle stop Request"""
Expand Down

0 comments on commit 4cf67a4

Please sign in to comment.