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

1741 : solr auto exec complete #2582

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

DuckflipXYZ
Copy link
Collaborator

@DuckflipXYZ DuckflipXYZ commented Jan 15, 2025

Not tested in remote

If #2581 is already merged, SorlServiceImpl.indexAllNoAuth() have to be replaced by this (done) :

@Async
    @Transactional
public void indexAllNoAuth() {
	List<ShanoirMetadata> documents = new ArrayList<>();
	Map<Long, List<String>> tags = new HashMap<>();
	ShanoirEvent event;

	try {
		event = new ShanoirEvent(
				ShanoirEventType.SOLR_INDEX_ALL_EVENT,
				null,
				0L,
				"Cleaning Solr index...",
				ShanoirEvent.IN_PROGRESS,
				0f);
		eventService.publishEvent(event);
		cleanOldIndex(event);
		fetchDatasToIndex(event, documents, tags);
		indexDatas(event, documents, tags);
	} catch (SolrServerException | IOException ignored) {
	}
}

# Conflicts:
#	shanoir-ng-datasets/src/main/java/org/shanoir/ng/solr/service/SolrServiceImpl.java

# Conflicts:
#	shanoir-ng-datasets/src/main/java/org/shanoir/ng/solr/service/SolrServiceImpl.java
@michaelkain
Copy link
Contributor

Hi @a-ba, I hope you are doing fine.
It waits for your feedback please.
Thank you and with kind regards, Michael

@DuckflipXYZ DuckflipXYZ added the REVIEWABLE Has to be reviewed label Feb 26, 2025
while (Objects.isNull(solrClient) && (System.currentTimeMillis() - startTime) < MAX_WAIT_TIME_MS) {
try {
solrClient = new HttpSolrClient.Builder(solrUrl).build();
} catch (Exception ignored) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not ignore silently all errors. Only « connection refused errors » should be caught here. Other errors should be reported immediately.

@Value("${spring.data.solr.host}")
private String solrUrl;

private static final int RETRY_INTERVAL_MS = 5000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5s is too much for may taste (it may happen on ordinary startup because there is a race condition, and i prefer the service to boot as fast as possible).

1 second would be sufficent, this won't overload the server (or if you fancy exponential backoff, you can set a 0.5s initial retry timeout, with a backoff factor of 1.5, i.e: interval = inverval * 1.5 inside the loop).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next-release REVIEWABLE Has to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Solr] Initialize datasets in solr when starting shanoir
3 participants