Skip to content

Commit

Permalink
fix: do not sleep before checking for the reloaded action status
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Jul 25, 2024
1 parent 9215daa commit 9b6781f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions hcloud/actions/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@ 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()
retries += 1

if self.status != Action.STATUS_RUNNING:
break

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 9b6781f

Please sign in to comment.