From 092dce7770444f316a8bb98700e7396fc91f0597 Mon Sep 17 00:00:00 2001 From: AFaust Date: Wed, 27 Nov 2024 10:48:56 +0100 Subject: [PATCH] Improve transaction polling - immediately stop if no newer transaction found (fewer pointless calls in systems without changes) - advance startTime when using getNextTxCommitTime to potentially avoid repeated calls if alreadyFoundTransactions (unlikely, but feels wrong not to adjust after having queried that window of time) --- .../java/org/alfresco/solr/tracker/MetadataTracker.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java b/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java index 82331fcf8..6b4eb22f0 100644 --- a/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java +++ b/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java @@ -789,6 +789,13 @@ protected Transactions getSomeTransactions(BoundedDeque txnsFound, Thread.currentThread().getId(), coreName, startTime, nextTxCommitTime); transactions = client.getTransactions(nextTxCommitTime, null, nextTxCommitTime + timeStep, null, maxResults); + // advance for next iteration in case alreadyFoundTransactions() yields true + startTime = nextTxCommitTime + timeStep; + } + else + { + // no point in additional iterations when there is no newer transaction + break; } }