Fix incorrect distance being used in update propagation SQL and reduce queue size

This commit is contained in:
s809
2025-02-07 01:05:14 +05:00
parent 8385eeb62c
commit 532ac8fe01
2 changed files with 6 additions and 6 deletions
@@ -68,7 +68,7 @@ public class FullDataSourceProviderV2
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
private static final IMinecraftClientWrapper MC_CLIENT = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
protected static final int NUMBER_OF_PARENT_UPDATE_TASKS_PER_THREAD = 50;
protected static final int NUMBER_OF_PARENT_UPDATE_TASKS_PER_THREAD = 5;
/** how many parent update tasks can be in the queue at once */
protected static int getMaxUpdateTaskCount() { return NUMBER_OF_PARENT_UPDATE_TASKS_PER_THREAD* Config.Common.MultiThreading.numberOfThreads.get(); }
@@ -81,7 +81,7 @@ public class FullDataSourceV2Repo extends AbstractDhRepo<Long, FullDataSourceV2D
@Nullable
@Override @Nullable
public FullDataSourceV2DTO convertResultSetToDto(ResultSet resultSet) throws ClassCastException, IOException, SQLException
{
//======================//
@@ -313,7 +313,7 @@ public class FullDataSourceV2Repo extends AbstractDhRepo<Long, FullDataSourceV2D
/** should be be very similar to {@link FullDataSourceV2Repo#getChildPositionsToUpdateSql} */
private final String getParentPositionsToUpdateSql =
"SELECT DetailLevel, PosX, PosZ, " +
" (sqrt(pow(PosX - ?, 2) + pow(PosZ - ?, 2))) AS Distance " +
" abs((PosX << (6 + DetailLevel)) - ?) + abs((PosZ << (6 + DetailLevel)) - ?) AS Distance " +
"FROM "+this.getTableName()+" " +
"WHERE ApplyToParent = 1 " +
"ORDER BY Distance ASC " +
@@ -324,7 +324,7 @@ public class FullDataSourceV2Repo extends AbstractDhRepo<Long, FullDataSourceV2D
/** should be be very similar to {@link FullDataSourceV2Repo#getParentPositionsToUpdateSql} */
private final String getChildPositionsToUpdateSql =
"SELECT DetailLevel, PosX, PosZ, " +
" (sqrt(pow(PosX - ?, 2) + pow(PosZ - ?, 2))) AS Distance " +
" abs((PosX << (6 + DetailLevel)) - ?) + abs((PosZ << (6 + DetailLevel)) - ?) AS Distance " +
"FROM "+this.getTableName()+" " +
"WHERE ApplyToChildren = 1 " +
"ORDER BY Distance ASC " +
@@ -540,8 +540,8 @@ public class FullDataSourceV2Repo extends AbstractDhRepo<Long, FullDataSourceV2D
public LongArrayList getAllPositions()
{
LongArrayList list = new LongArrayList();
PreparedStatement statement = this.createPreparedStatement(getAllPositionsSql);
PreparedStatement statement = this.createPreparedStatement(this.getAllPositionsSql);
if (statement == null)
{
return list;