Skip to content

Commit

Permalink
Merge pull request #13 from Nexus633/patch-2
Browse files Browse the repository at this point in the history
Fix waitForTaskToFinish1 & waitForTaskToFinish
  • Loading branch information
franklupo authored Feb 25, 2021
2 parents b1335b1 + 4800a01 commit c83bebc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/PveClientBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,10 @@ public function waitForTaskToFinish($node, $task, $wait = 500, $timeOut = 10000)
}
$timeStart = time();
$waitTime = time();
while ($isRunning && (time() - $timeStart) < $timeOut) {
while (($isRunning && (time() - $timeStart)) < $timeOut) {
if ((time() - $waitTime) >= $wait) {
$waitTime = time();
$isRunning = taskIsRunning($node, $task);
$isRunning = $this->taskIsRunning($node, $task);
}
}

Expand All @@ -414,7 +414,10 @@ public function waitForTaskToFinish($node, $task, $wait = 500, $timeOut = 10000)
* @return bool
*/
function waitForTaskToFinish1($task, $wait = 500, $timeOut = 10000) {
return waitForTaskToFinish(preg_split(':', $task)[1], $task, $wait, $timeOut);
if(!empty($task)){
return $this->waitForTaskToFinish(explode( ":", $task)[1], $task, $wait, $timeOut);
}
return false;
}

/**
Expand Down

0 comments on commit c83bebc

Please sign in to comment.