Merge branch 'release/3.4'

This commit is contained in:
Dylan K. Taylor 2018-11-04 22:18:15 +00:00
commit 1c9137aa94
3 changed files with 16 additions and 29 deletions

View File

@ -226,22 +226,17 @@ class AsyncPool{
if($task->isCrashed()){ if($task->isCrashed()){
$this->logger->critical("Could not execute asynchronous task " . (new \ReflectionClass($task))->getShortName() . ": Task crashed"); $this->logger->critical("Could not execute asynchronous task " . (new \ReflectionClass($task))->getShortName() . ": Task crashed");
}elseif(!$task->hasCancelledRun()){ }elseif(!$task->hasCancelledRun()){
try{ /*
/* * It's possible for a task to submit a progress update and then finish before the progress
* It's possible for a task to submit a progress update and then finish before the progress * update is detected by the parent thread, so here we consume any missed updates.
* update is detected by the parent thread, so here we consume any missed updates. *
* * When this happens, it's possible for a progress update to arrive between the previous
* When this happens, it's possible for a progress update to arrive between the previous * checkProgressUpdates() call and the next isGarbage() call, causing progress updates to be
* checkProgressUpdates() call and the next isGarbage() call, causing progress updates to be * lost. Thus, it's necessary to do one last check here to make sure all progress updates have
* lost. Thus, it's necessary to do one last check here to make sure all progress updates have * been consumed before completing.
* been consumed before completing. */
*/ $task->checkProgressUpdates();
$task->checkProgressUpdates(); $task->onCompletion();
$task->onCompletion();
}catch(\Throwable $e){
$this->logger->critical("Could not execute completion of asynchronous task " . (new \ReflectionClass($task))->getShortName() . ": " . $e->getMessage());
$this->logger->logException($e);
}
} }
}else{ }else{
break; //current task is still running, skip to next worker break; //current task is still running, skip to next worker

View File

@ -44,10 +44,6 @@ class FileWriteTask extends AsyncTask{
} }
public function onRun() : void{ public function onRun() : void{
try{ file_put_contents($this->path, $this->contents, $this->flags);
file_put_contents($this->path, $this->contents, $this->flags);
}catch(\Throwable $e){
}
} }
} }

View File

@ -147,13 +147,9 @@ class SendUsageTask extends AsyncTask{
} }
public function onRun() : void{ public function onRun() : void{
try{ Internet::postURL($this->endpoint, $this->data, 5, [
Internet::postURL($this->endpoint, $this->data, 5, [ "Content-Type: application/json",
"Content-Type: application/json", "Content-Length: " . strlen($this->data)
"Content-Length: " . strlen($this->data) ]);
]);
}catch(\Throwable $e){
}
} }
} }