Skip to content

Commit 3e0a85b

Browse files
authored
fix: do not sleep before checking for the reloaded action status (#426)
Do not sleep before checking for the reloaded action status.
1 parent 08b8b86 commit 3e0a85b

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

hcloud/actions/client.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ def wait_until_finished(self, max_retries: int | None = None) -> None:
2828
max_retries = self._client._client._poll_max_retries
2929

3030
retries = 0
31-
while self.status == Action.STATUS_RUNNING:
31+
while True:
32+
self.reload()
33+
if self.status != Action.STATUS_RUNNING:
34+
break
35+
36+
retries += 1
3237
if retries < max_retries:
33-
self.reload()
34-
retries += 1
3538
# pylint: disable=protected-access
3639
time.sleep(self._client._client._poll_interval_func(retries))
37-
else:
38-
raise ActionTimeoutException(action=self)
40+
continue
41+
42+
raise ActionTimeoutException(action=self)
3943

4044
if self.status == Action.STATUS_ERROR:
4145
raise ActionFailedException(action=self)

0 commit comments

Comments
 (0)