mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Scheduler: Catch exceptions thrown from AsyncTask->onCompletion()
This commit is contained in:
@ -159,8 +159,17 @@ class AsyncPool{
|
||||
}
|
||||
if($task->isGarbage() and !$task->isRunning() and !$task->isCrashed()){
|
||||
if(!$task->hasCancelledRun()){
|
||||
$task->onCompletion($this->server);
|
||||
$this->server->getScheduler()->removeLocalComplex($task);
|
||||
try{
|
||||
$task->onCompletion($this->server);
|
||||
if(!$this->server->getScheduler()->removeLocalComplex($task)){
|
||||
$this->server->getLogger()->notice("AsyncTask " . get_class($task) . " stored local complex data but did not remove them after completion");
|
||||
}
|
||||
}catch(\Throwable $e){
|
||||
$this->server->getLogger()->critical("Could not execute completion of asychronous task " . (new \ReflectionClass($task))->getShortName() . ": " . $e->getMessage());
|
||||
$this->server->getLogger()->logException($e);
|
||||
|
||||
$this->server->getScheduler()->removeLocalComplex($task); //silent
|
||||
}
|
||||
}
|
||||
|
||||
$this->removeTask($task);
|
||||
|
Reference in New Issue
Block a user