- 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, @PathVariable("repoId") String repoId,
@RequestParam(name = "size", required = false, defaultValue = "20") int size) throws JSONException { @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 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; size = 0;
do { do {
aggregationInfo = aggregationService.getRepositoryAggregations(repoId, size, size + 50); aggregationInfoList = aggregationService.getRepositoryAggregations(repoId, size, size + 50);
for (AggregationInfo aggregationDetail : aggregationInfo) { for (AggregationInfo aggregationInfo : aggregationInfoList) {
if (aggregationDetail.isIndexedVersion()) { if (aggregationInfo.isIndexedVersion()) {
collectionMonitorSummary.setLastIndexedVersion(aggregationDetail); collectionMonitorSummary.setLastIndexedVersion(aggregationInfo);
break; break;
} }
} }
size += 30; size += 50;
} while (aggregationInfo.size() != 0 && collectionMonitorSummary.getLastIndexedVersion() == null); } while (aggregationInfoList.size() != 0 && collectionMonitorSummary.getLastIndexedVersion() == null);
return collectionMonitorSummary; return collectionMonitorSummary;
} }

View File

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