added other check on es return code

This commit is contained in:
Enrico Ottonello 2020-07-23 23:12:07 +02:00
parent 173b0c289e
commit 5eaa655f01
2 changed files with 7 additions and 2 deletions

View File

@ -125,6 +125,7 @@ public class BulkUpload {
request.add(new IndexRequest(elasticSearchIndexName).id(idES)
.source(ace.toJson(),XContentType.JSON));
log.info("Indexing: "+idES+" :: "+ace.toJson());
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);
if (bulkResponse!=null) {
esResponseCode = bulkResponse.status().getStatus();
@ -133,6 +134,9 @@ public class BulkUpload {
log.error("FailureMessage: " + bulkResponse.buildFailureMessage());
}
}
else {
esResponseCode = -3;
}
} catch (Exception e) {
log.error("Indexing "+e.getMessage());
return -1;

View File

@ -63,6 +63,7 @@ public class RunSPARQLQueryService {
if (queryTemplate==null)
return null;
final String selectQueryTemplate = queryTemplate.replaceAll("%datasource", datasource).replaceAll("%collectionId", collectionId);
log.info("Start indexing "+ recordIds.size()+ " records ...");
recordIds.forEach(recordId -> {
int operationResult = executeQueryGraph(selectQueryTemplate, recordId, isCollection);
log.info("Indexing final code: "+Integer.toString(operationResult));
@ -71,9 +72,9 @@ public class RunSPARQLQueryService {
}
private int executeQueryGraph(String selectQueryTemplate, String recordId, boolean isCollection){
// to avoid heap overload on graphdb
// decrease queries execution rate to avoid heap overload on graphdb
try {
Thread.sleep(100);
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}