Feature/optimize info endpoint using promise.all (#3742)

* Optimize by using Promise.all()

* Update changelog
pull/3741/head^2
Thomas Kaul 3 months ago committed by GitHub
parent bdb3a8f1dc
commit 557a0bf808
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Optimized the asynchronous operations using `Promise.all()` in the info service
- Extracted the users from the admin control panel endpoint to a dedicated endpoint - Extracted the users from the admin control panel endpoint to a dedicated endpoint
- Improved the language localization for Italian (`it`) - Improved the language localization for Italian (`it`)

@ -54,9 +54,6 @@ export class InfoService {
public async get(): Promise<InfoItem> { public async get(): Promise<InfoItem> {
const info: Partial<InfoItem> = {}; const info: Partial<InfoItem> = {};
let isReadOnlyMode: boolean; let isReadOnlyMode: boolean;
const platforms = await this.platformService.getPlatforms({
orderBy: { name: 'asc' }
});
const globalPermissions: string[] = []; const globalPermissions: string[] = [];
@ -100,22 +97,30 @@ export class InfoService {
globalPermissions.push(permissions.enableSystemMessage); globalPermissions.push(permissions.enableSystemMessage);
} }
const isUserSignupEnabled = const [
await this.propertyService.isUserSignupEnabled(); benchmarks,
demoAuthToken,
isUserSignupEnabled,
platforms,
statistics,
subscriptions,
tags
] = await Promise.all([
this.benchmarkService.getBenchmarkAssetProfiles(),
this.getDemoAuthToken(),
this.propertyService.isUserSignupEnabled(),
this.platformService.getPlatforms({
orderBy: { name: 'asc' }
}),
this.getStatistics(),
this.getSubscriptions(),
this.tagService.get()
]);
if (isUserSignupEnabled) { if (isUserSignupEnabled) {
globalPermissions.push(permissions.createUserAccount); globalPermissions.push(permissions.createUserAccount);
} }
const [benchmarks, demoAuthToken, statistics, subscriptions, tags] =
await Promise.all([
this.benchmarkService.getBenchmarkAssetProfiles(),
this.getDemoAuthToken(),
this.getStatistics(),
this.getSubscriptions(),
this.tagService.get()
]);
return { return {
...info, ...info,
benchmarks, benchmarks,

Loading…
Cancel
Save