Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/main/java/net/coreprotect/consumer/process/Process.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ protected static void processConsumer(int processId, boolean lastRun) {
boolean hasEntityContainerTransactions = false;
boolean hasEntityInteractions = false;
List<EntitySpawnData> entitySpawnUpdateData = new ArrayList<>();
List<Integer> entitySpawnUpdateIndexes = new ArrayList<>();
Set<UUID> entityIdentityUuids = new HashSet<>();
Set<Integer> entityIdentityRowIds = new HashSet<>();
for (int index = 0; index < consumerDataSize; index++) {
Expand Down Expand Up @@ -236,6 +237,7 @@ else if (action == Process.ENTITY_SPAWN_UPDATE || action == Process.ENTITY_CONTA
continue;
}
entitySpawnUpdateData.add(spawnData);
entitySpawnUpdateIndexes.add(index);
if (spawnData.getPreviousUuid() != null) {
entityIdentityUuids.add(spawnData.getPreviousUuid());
}
Expand Down Expand Up @@ -268,7 +270,6 @@ else if (action == Process.ENTITY_SPAWN_UPDATE || action == Process.ENTITY_CONTA
entitySpawnUpdates = hasEntitySpawnUpdates ? writeBatch.entitySpawnUpdates() : null;
if (entitySpawnUpdates != null) {
entitySpawnUpdates.prefetch(entitySpawnUpdateData);
entitySpawnUpdateData.clear();
}
processingStarted = true;
for (int i = 0; i < consumerDataSize; i++) {
Expand Down Expand Up @@ -556,6 +557,19 @@ else if (existingSpawnIdentity == null) {
retryConsumerBatch(processId, consumerData, users, consumerObject, processedThrough);
return;
}
if (entitySpawnUpdates != null) {
int firstRemaining = 0;
while (firstRemaining < entitySpawnUpdateIndexes.size() && entitySpawnUpdateIndexes.get(firstRemaining) <= i) {
firstRemaining++;
}
if (firstRemaining > 0) {
entitySpawnUpdateIndexes.subList(0, firstRemaining).clear();
entitySpawnUpdateData.subList(0, firstRemaining).clear();
}
if (!entitySpawnUpdateData.isEmpty()) {
entitySpawnUpdates.prefetch(entitySpawnUpdateData);
}
}
}
}
catch (Exception e) {
Expand Down
Loading