Skip to content

Commit

Permalink
feat: separate new frontend api path for perf measurements (#6583)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Mar 15, 2024
1 parent 5d10758 commit 2716f72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/lib/features/frontend-api/frontend-api-controller.ts
Expand Up @@ -213,6 +213,14 @@ export default class FrontendAPIController extends Controller {
)}`,
);
}
} else if (
this.config.flagResolver.isEnabled('returnGlobalFrontendApiCache')
) {
toggles =
await this.services.frontendApiService.getNewFrontendApiFeatures(
req.user,
FrontendAPIController.createContext(req),
);
} else {
toggles =
await this.services.frontendApiService.getFrontendApiFeatures(
Expand All @@ -221,19 +229,13 @@ export default class FrontendAPIController extends Controller {
);
}

const returnedToggles = this.config.flagResolver.isEnabled(
'returnGlobalFrontendApiCache',
)
? newToggles
: toggles;

res.set('Cache-control', 'no-cache');

this.services.openApiService.respondWithValidation(
200,
res,
frontendApiFeaturesSchema.$id,
{ toggles: returnedToggles },
{ toggles },
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/server-dev.ts
Expand Up @@ -52,7 +52,7 @@ process.nextTick(async () => {
sdkReporting: true,
outdatedSdksBanner: true,
globalFrontendApiCache: true,
returnGlobalFrontendApiCache: true,
returnGlobalFrontendApiCache: false,
},
},
authentication: {
Expand Down

0 comments on commit 2716f72

Please sign in to comment.