Store last delay, so if a search takes a long time, it does not bog the server down.
This commit is contained in:
parent
949ec511b7
commit
1c866e304e
3 changed files with 11 additions and 3 deletions
|
@ -49,7 +49,7 @@ mod_name=Aria's Essentials
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=GPLv3
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.1.121823.1657
|
||||
mod_version=1.1.121823.1856
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
|
@ -52,6 +52,13 @@ public class RTP
|
|||
public WorldPosition position;
|
||||
private List<Block> BLACKLIST = Lists.of(Blocks.LAVA, Blocks.WATER);
|
||||
protected int tries;
|
||||
protected int lastThreadDelay = 1;
|
||||
|
||||
protected RTP withThreadDelay(int delay)
|
||||
{
|
||||
lastThreadDelay=delay;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDimension(ServerLevel level)
|
||||
{
|
||||
|
|
|
@ -70,8 +70,9 @@ public class RandomPositionLocator extends Task
|
|||
}else {
|
||||
// Schedule the task to execute
|
||||
//run();
|
||||
RandomPositionLocator next = new RandomPositionLocator(contain);
|
||||
DelayedExecutorService.getInstance().schedule(next, 1);
|
||||
|
||||
RandomPositionLocator next = new RandomPositionLocator(contain.withThreadDelay(contain.lastThreadDelay+1));
|
||||
DelayedExecutorService.getInstance().schedule(next, contain.lastThreadDelay+1);
|
||||
AriasEssentials.LOGGER.info("Giving up current RTP search. Scheduling another search in 1 second");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue