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()){
$this->logger->critical("Could not execute asynchronous task " . (new \ReflectionClass($task))->getShortName() . ": Task crashed");
}elseif(!$task->hasCancelledRun()){
try{
/*
* 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.
*
* 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
* lost. Thus, it's necessary to do one last check here to make sure all progress updates have
* been consumed before completing.
*/
$task->checkProgressUpdates();
$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);
}
/*
* 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.
*
* 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
* lost. Thus, it's necessary to do one last check here to make sure all progress updates have
* been consumed before completing.
*/
$task->checkProgressUpdates();
$task->onCompletion();
}
}else{
break; //current task is still running, skip to next worker

View File

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

View File

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