mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
AsyncPool: Lazy-start AsyncWorkers when they are needed only
This changes how the AsyncPool works so that it does not immediately always start all of the workers in the pool. Instead, workers will be started only when an idle worker was not found. This allows for significant memory footprint reductions while idle. In effect the async-workers setting in pocketmine.yml now dictates a _maximum_ pool size, not a fixed pool size.
This commit is contained in:
@ -139,7 +139,7 @@ class PopulationTask extends AsyncTask{
|
||||
$level = $server->getLevel($this->levelId);
|
||||
if($level !== null){
|
||||
if(!$this->state){
|
||||
$level->registerGenerator();
|
||||
$level->registerGeneratorToWorker($this->worker->getAsyncWorkerId() - 1);
|
||||
}
|
||||
|
||||
$chunk = Chunk::fastDeserialize($this->chunk);
|
||||
|
Reference in New Issue
Block a user