prevent issue of Fill process potentially making the server unresponsive while skipping over huge numbers of already fully generated chunks, most likely with very large already mostly generated worlds which are stored on old/slow hard drives

This commit is contained in:
Brettflan 2019-03-06 01:26:18 -06:00
parent b56d9faae6
commit 8e68e83e3d
1 changed files with 9 additions and 2 deletions

View File

@ -47,8 +47,8 @@ public class WorldFillTask implements Runnable
private transient int length = -1;
private transient int current = 0;
private transient boolean insideBorder = true;
private List<CoordXZ> storedChunks = new LinkedList<CoordXZ>();
private Set<CoordXZ> originalChunks = new HashSet<CoordXZ>();
private List<CoordXZ> storedChunks = new LinkedList<>();
private Set<CoordXZ> originalChunks = new HashSet<>();
private transient CoordXZ lastChunk = new CoordXZ(0, 0);
// for reporting progress back to user occasionally
@ -191,11 +191,18 @@ public class WorldFillTask implements Runnable
if (!forceLoad)
{
// skip past any chunks which are confirmed as fully generated using our super-special isChunkFullyGenerated routine
int rLoop = 0;
while (worldData.isChunkFullyGenerated(x, z))
{
rLoop++;
insideBorder = true;
if (!moveToNext())
return;
if (rLoop > 255)
{ // only skim through max 256 chunks (~8 region files) at a time here, to allow process to take a break if needed
readyToGo = true;
return;
}
}
}