- Fix a performance bug in "DashboardController.getCollectionMonitorSummary()", where the code for the "isIndexedVersion"-check, was re-checking 20 of the already-checked "aggregationInfo"-objects, in each new batch.

- Update some properties.
- Code polishing.
This commit is contained in:
Lampros Smyrnaios 2023-02-02 18:47:04 +02:00
parent 8bf0f76ad6
commit 3845a5103b
2 changed files with 22 additions and 13 deletions

View File

@ -57,20 +57,29 @@ public class DashboardController {
@PathVariable("repoId") String repoId,
@RequestParam(name = "size", required = false, defaultValue = "20") int size) throws JSONException {
List<AggregationInfo> aggregationInfo = aggregationService.getRepositoryAggregations(repoId, 0, size);
// Get the "aggregationInfo" for the first <number of> requested aggregations.
List<AggregationInfo> aggregationInfoList = aggregationService.getRepositoryAggregations(repoId, 0, size);
CollectionMonitorSummary collectionMonitorSummary = new CollectionMonitorSummary();
collectionMonitorSummary.setAggregationInfo(aggregationInfo);
collectionMonitorSummary.setAggregationInfo(aggregationInfoList);
// Search for the last indexed version, from the beginning of the list.
// TODO - WARNING! This is very slow, since each time it requests the next 50, it re-requests the whole list from the "/ds/aggregationhistory/" DSM-endpoint.
// inside "AggregationServiceImpl.getRepositoryAggregations()". Then it splits the list in a chunk of 50 and then iterate though it here..
// Since we already request the whole list each time anyway, just take that use it here!!
size = 0;
do {
aggregationInfo = aggregationService.getRepositoryAggregations(repoId, size, size + 50);
for (AggregationInfo aggregationDetail : aggregationInfo) {
if (aggregationDetail.isIndexedVersion()) {
collectionMonitorSummary.setLastIndexedVersion(aggregationDetail);
aggregationInfoList = aggregationService.getRepositoryAggregations(repoId, size, size + 50);
for (AggregationInfo aggregationInfo : aggregationInfoList) {
if (aggregationInfo.isIndexedVersion()) {
collectionMonitorSummary.setLastIndexedVersion(aggregationInfo);
break;
}
}
size += 30;
} while (aggregationInfo.size() != 0 && collectionMonitorSummary.getLastIndexedVersion() == null);
size += 50;
} while (aggregationInfoList.size() != 0 && collectionMonitorSummary.getLastIndexedVersion() == null);
return collectionMonitorSummary;
}

View File

@ -15,11 +15,11 @@ spring:
services:
provide:
dev-machine: 88.197.53.71
dev-machine: 88.197.53.71 # VM-71
aai:
baseURL: https://aai.openaire.eu
oidc:
domain: .openaire.eu
domain: .openaire.eu # use empty value for local, otherwise: ".openaire.eu"
id: XX
issuer: ${services.provide.aai.baseURL}/oidc/
redirectURL: http://localhost:${server.port}${server.servlet.context-path}/openid_connect_login
@ -37,13 +37,13 @@ services:
broker:
api: api/
openaire: openaireBroker
port: 8080
url: https://broker1-dev-dnet.d4science.org
port: 443
url: https://beta.broker.openaire.eu
clients:
dsm: https://dev-openaire.d4science.org/openaire
search: https://beta.services.openaire.eu/search/v2/api
usageEvents: http://beta.lbs.openaire.eu:8080/ajax/summary
usagestats: https://services.openaire.eu/usagestats
usagestats: https://beta.services.openaire.eu/usagestats
db:
driverClassName: org.postgresql.Driver
password: dnetPwd