Merge pull request #8980 from toniprieto/index-consumer-readonly-mode

Improve performance of discovery consumer when there are many items to index
This commit is contained in:
Tim Donohue
2023-11-03 10:55:28 -05:00
committed by GitHub
5 changed files with 83 additions and 0 deletions

View File

@@ -205,6 +205,10 @@ public class IndexEventConsumer implements Consumer {
@Override
public void end(Context ctx) throws Exception {
// Change the mode to readonly to improve performance
Context.Mode originalMode = ctx.getCurrentMode();
ctx.setMode(Context.Mode.READ_ONLY);
try {
for (String uid : uniqueIdsToDelete) {
try {
@@ -234,6 +238,8 @@ public class IndexEventConsumer implements Consumer {
uniqueIdsToDelete.clear();
createdItemsToUpdate.clear();
}
ctx.setMode(originalMode);
}
}