mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2026-10-28 09:44:56 +00:00
Fix ClickHouse queue stalling from per-entity UUID lookups (#1038)
* Reload entity spawn lookups in bulk after each database commit * Trim consumed prefixes after successful commit
This commit is contained in:
1 parent
55576f9c3a
commit
61f0282596
1 file changed
+15
-1
@@ -193,6 +193,7 @@ public class Process {
|
||||
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++) {
|
||||
@@ -236,6 +237,7 @@ public class Process {
|
||||
continue;
|
||||
}
|
||||
entitySpawnUpdateData.add(spawnData);
|
||||
entitySpawnUpdateIndexes.add(index);
|
||||
if (spawnData.getPreviousUuid() != null) {
|
||||
entityIdentityUuids.add(spawnData.getPreviousUuid());
|
||||
}
|
||||
@@ -268,7 +270,6 @@ public class Process {
|
||||
entitySpawnUpdates = hasEntitySpawnUpdates ? writeBatch.entitySpawnUpdates() : null;
|
||||
if (entitySpawnUpdates != null) {
|
||||
entitySpawnUpdates.prefetch(entitySpawnUpdateData);
|
||||
entitySpawnUpdateData.clear();
|
||||
}
|
||||
processingStarted = true;
|
||||
for (int i = 0; i < consumerDataSize; i++) {
|
||||
@@ -556,6 +557,19 @@ public class Process {
|
||||
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) {
|
||||
|
||||
Reference in new issue
Block a user