Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not sleep before checking for the reloaded action status #426

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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