1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

refactor: encapsulate playground limit in service (#7700)

This commit is contained in:
Mateusz Kwasniewski 2024-07-30 12:40:27 +02:00 committed by GitHub
parent 50167d4f9e
commit c828d01135
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 8 deletions

View File

@ -101,12 +101,18 @@ export class PlaygroundService {
projects: typeof ALL | string[],
environments: string[],
context: SdkContextSchema,
limit: number,
userId: number,
): Promise<{
result: AdvancedPlaygroundFeatureEvaluationResult[];
invalidContextProperties: string[];
}> {
// used for runtime control, do not remove
const { payload } = this.flagResolver.getVariant('advancedPlayground');
const limit =
payload?.value && Number.isInteger(Number.parseInt(payload?.value))
? Number.parseInt(payload?.value)
: 15000;
const segments = await this.segmentReadModel.getActive();
let filteredProjects: typeof projects = projects;

View File

@ -118,19 +118,12 @@ export default class PlaygroundController extends Controller {
res: Response<AdvancedPlaygroundResponseSchema>,
): Promise<void> {
const { user } = req;
// used for runtime control, do not remove
const { payload } = this.flagResolver.getVariant('advancedPlayground');
const limit =
payload?.value && Number.isInteger(Number.parseInt(payload?.value))
? Number.parseInt(payload?.value)
: 15000;
const { result, invalidContextProperties } =
await this.playgroundService.evaluateAdvancedQuery(
req.body.projects || '*',
req.body.environments,
req.body.context,
limit,
extractUserIdFromUser(user),
);