pyvcloud icon indicating copy to clipboard operation
pyvcloud copied to clipboard

Bug In Task Connection Timeout

Open Harish0596 opened this issue 4 years ago • 0 comments

    start_time = datetime.now()
    while True:
        task = self._get_task_status(task_href)
        if callback is not None:
            callback(task)
        task_status = task.get('status').lower()
        for status in expected_target_statuses:
            if task_status == status.value.lower():
                return task
        for status in _fail_on_statuses:
            if task_status == status.value.lower():
                raise VcdTaskException(task_status, task.Error)
        if start_time - datetime.now() > timedelta(seconds=timeout):
            break
        time.sleep(poll_frequency)
    raise TaskTimeoutException("Task timeout")

in the above code when we are checking start_time - datetime.now() which will we be negative all the time, so TaskTimeoutException will never raise, it should be datetime.now() - start_time

Harish0596 avatar May 01 '20 08:05 Harish0596