Skip to content

Commit

Permalink
fix: do not sleep before checking for the reloaded action status (#426)
Browse files Browse the repository at this point in the history
Do not sleep before checking for the reloaded action status.
  • Loading branch information
jooola committed Jul 25, 2024
1 parent 08b8b86 commit 3e0a85b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions hcloud/actions/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ def wait_until_finished(self, max_retries: int | None = None) -> None:
max_retries = self._client._client._poll_max_retries

retries = 0
while self.status == Action.STATUS_RUNNING:
while True:
self.reload()
if self.status != Action.STATUS_RUNNING:
break

retries += 1
if retries < max_retries:
self.reload()
retries += 1
# pylint: disable=protected-access
time.sleep(self._client._client._poll_interval_func(retries))
else:
raise ActionTimeoutException(action=self)
continue

raise ActionTimeoutException(action=self)

if self.status == Action.STATUS_ERROR:
raise ActionFailedException(action=self)
Expand Down

0 comments on commit 3e0a85b

Please sign in to comment.