World: fixed additional edge case - population promise rejected before task completion

if this happened, the index would stay set in activeChunkPopulationTasks, eventually causing the generation queue to jam up completely and non-forced generation to come to a standstill.
This commit is contained in:
Dylan K. Taylor 2021-11-02 14:30:23 +00:00
parent 1775699f05
commit 34ea199fb0
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -2918,7 +2918,11 @@ class World implements ChunkManager{
}
}
if(isset($this->chunkPopulationRequestMap[$index = World::chunkHash($x, $z)]) && isset($this->activeChunkPopulationTasks[$index])){
$index = World::chunkHash($x, $z);
if(!isset($this->chunkPopulationRequestMap[$index])){
$this->logger->debug("Discarding population result for chunk x=$x,z=$z - promise was already broken");
unset($this->activeChunkPopulationTasks[$index]);
}elseif(isset($this->activeChunkPopulationTasks[$index])){
if($dirtyChunks === 0){
$oldChunk = $this->loadChunk($x, $z);
$this->setChunk($x, $z, $chunk);