Change the database mode to READ_ONLY during the indexing by discovery consumer (IndexEventConsumer)

This commit is contained in:
Toni Prieto
2023-07-26 12:31:43 +02:00
parent 92844f0b05
commit 94822b50af

View File

@@ -201,6 +201,10 @@ public class IndexEventConsumer implements Consumer {
@Override
public void end(Context ctx) throws Exception {
// Change the mode to readonly to improve the performance
Context.Mode originalMode = ctx.getCurrentMode();
ctx.setMode(Context.Mode.READ_ONLY);
try {
for (String uid : uniqueIdsToDelete) {
try {
@@ -231,6 +235,8 @@ public class IndexEventConsumer implements Consumer {
createdItemsToUpdate.clear();
}
}
ctx.setMode(originalMode);
}
private void indexObject(Context ctx, IndexableObject iu, boolean preDb) throws SQLException {