Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Apr 23, 2024
1 parent 8d62f1d commit 5081228
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/lib/features/frontend-api/frontend-api-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export class FrontendApiRepository
async start(): Promise<void> {
this.running = true;

await this.globalFrontendApiCache.refreshData();

this.emit(UnleashEvents.Ready);
this.emit(UnleashEvents.Changed);
}
Expand Down
4 changes: 1 addition & 3 deletions src/lib/features/frontend-api/global-frontend-api-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ export class GlobalFrontendApiCache extends EventEmitter {
}

// TODO: fetch only relevant projects/environments based on tokens
private async refreshData() {
public async refreshData() {
try {
const stopTimer = this.timer('refreshData');
this.featuresByEnvironment = await this.getAllFeatures();
this.segments = await this.getAllSegments();
if (this.status === 'starting') {
Expand All @@ -122,7 +121,6 @@ export class GlobalFrontendApiCache extends EventEmitter {
this.status = 'updated';
this.emit('updated');
}
stopTimer();
} catch (e) {
this.logger.error('Cannot load data for token', e);
}
Expand Down

0 comments on commit 5081228

Please sign in to comment.