mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +00:00
Only save batch buffer when compressing chunks
faster due to not needing to serialize, and reduces memory footprint of caching
This commit is contained in:
parent
60f5c7ccef
commit
905d3f1610
@ -74,14 +74,18 @@ class ChunkRequestTask extends AsyncTask{
|
||||
$batch = new BatchPacket();
|
||||
$batch->addPacket($pk);
|
||||
$batch->compress($this->compressionLevel);
|
||||
$batch->encode();
|
||||
|
||||
$this->setResult($batch);
|
||||
$this->setResult($batch->buffer, false);
|
||||
}
|
||||
|
||||
public function onCompletion(Server $server){
|
||||
$level = $server->getLevel($this->levelId);
|
||||
if($level instanceof Level and $this->hasResult()){
|
||||
$level->chunkRequestCallback($this->chunkX, $this->chunkZ, $this->getResult());
|
||||
$batch = new BatchPacket($this->getResult());
|
||||
$batch->compressed = true;
|
||||
$batch->isEncoded = true;
|
||||
$level->chunkRequestCallback($this->chunkX, $this->chunkZ, $batch);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user