Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the orgs indexing batch configurable #6823

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
*/
public class OrgDisambiguatedManagerImpl implements OrgDisambiguatedManager {

private static final int INDEXING_CHUNK_SIZE = 1000;
private static final int INCORRECT_POPULARITY_CHUNK_SIZE = 1000;
private static final Logger LOGGER = LoggerFactory.getLogger(OrgDisambiguatedManagerImpl.class);

Expand Down Expand Up @@ -75,18 +74,21 @@ public class OrgDisambiguatedManagerImpl implements OrgDisambiguatedManager {
@Resource
private List<OrgDisambiguatedExternalIdNormalizer> orgDisambiguatedExternalIdNormalizers;

@Value("${org.orcid.persistence.messaging.updated.disambiguated_org.indexing.batchSize:1000}")
private int indexingBatchSize;

@Override
synchronized public void processOrgsForIndexing() {
LOGGER.info("About to process disambiguated orgs for indexing");
List<OrgDisambiguatedEntity> entities = null;
int startIndex = 0;
do {
entities = orgDisambiguatedDaoReadOnly.findOrgsPendingIndexing(startIndex, INDEXING_CHUNK_SIZE);
entities = orgDisambiguatedDaoReadOnly.findOrgsPendingIndexing(startIndex, indexingBatchSize);
LOGGER.info("Found chunk of {} disambiguated orgs for indexing", entities.size());
for (OrgDisambiguatedEntity entity : entities) {
processDisambiguatedOrgInTransaction(entity);
}
startIndex = startIndex + INDEXING_CHUNK_SIZE;
startIndex = startIndex + indexingBatchSize;
} while (!entities.isEmpty());

}
Expand All @@ -98,13 +100,13 @@ synchronized public void markOrgsForIndexingAsGroup() {
int startIndex = 0;
do {
LOGGER.info("GROUP: Start index is: " + startIndex);
entities = orgDisambiguatedDaoReadOnly.findOrgsToGroup(startIndex, INDEXING_CHUNK_SIZE);
entities = orgDisambiguatedDaoReadOnly.findOrgsToGroup(startIndex, indexingBatchSize);
LOGGER.info("GROUP: Found chunk of {} disambiguated orgs for indexing as group", entities.size());
for (OrgDisambiguatedEntity entity : entities) {

new OrgGrouping(entity, this).markGroupForIndexing(orgDisambiguatedDao);
}
startIndex = startIndex + INDEXING_CHUNK_SIZE;
startIndex = startIndex + indexingBatchSize;

} while (!entities.isEmpty());

Expand Down