Skip to content

Commit

Permalink
Change the database mode to READ_ONLY during the indexing by discover…
Browse files Browse the repository at this point in the history
…y consumer (IndexEventConsumer)
  • Loading branch information
toniprieto committed Oct 13, 2023
1 parent 92844f0 commit 94822b5
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ public void consume(Context ctx, Event event) throws Exception {
@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 {
Expand Down Expand Up @@ -231,6 +235,8 @@ public void end(Context ctx) throws Exception {
createdItemsToUpdate.clear();
}
}

ctx.setMode(originalMode);
}

private void indexObject(Context ctx, IndexableObject iu, boolean preDb) throws SQLException {
Expand Down

0 comments on commit 94822b5

Please sign in to comment.