VMware: Fix wait_for_task backoff behavior
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 796d8b5dc8
)
This commit is contained in:
parent
426d4bf8d6
commit
9a0f1d8915
2 changed files with 4 additions and 1 deletions
3
changelogs/fragments/vmware_wait_for_task_fix.yaml
Normal file
3
changelogs/fragments/vmware_wait_for_task_fix.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
minor_changes:
|
||||
- Fix timer in exponential backoff algorithm in vmware.py.
|
|
@ -58,7 +58,7 @@ def wait_for_task(task, max_backoff=64, timeout=3600):
|
|||
finally:
|
||||
raise_from(TaskError(error_msg), task.info.error)
|
||||
if task.info.state in [vim.TaskInfo.State.running, vim.TaskInfo.State.queued]:
|
||||
sleep_time = min(2 ** failure_counter + randint(1, 1000), max_backoff)
|
||||
sleep_time = min(2 ** failure_counter + randint(1, 1000) / 1000, max_backoff)
|
||||
time.sleep(sleep_time)
|
||||
failure_counter += 1
|
||||
|
||||
|
|
Loading…
Reference in a new issue