Added AsyncTask progress update API

This commit is contained in:
SOFe
2016-11-12 17:31:59 +08:00
parent bd5bbbea10
commit e6485c4734
3 changed files with 91 additions and 9 deletions

View File

@ -142,8 +142,13 @@ class AsyncPool{
Timings::$schedulerAsyncTimer->startTiming();
foreach($this->tasks as $task){
if($task->progressUpdates !== null){
if($task->progressUpdates->count() !== 0){
$progress = $task->progressUpdates->shift();
$task->onProgressUpdate($this->server, $progress);
}
}
if($task->isGarbage() and !$task->isRunning() and !$task->isCrashed()){
if(!$task->hasCancelledRun()){
$task->onCompletion($this->server);
$this->server->getScheduler()->removeLocalComplex($task);