Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ Remove remaining feature flag test warning noise #2185

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('featureFlagContexts', () => {
})

afterEach(() => {
featureFlagContexts.stop()
resetExperimentalFeatures()
setupBuilder.cleanup()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface FeatureFlagContexts {
findFeatureFlagEvaluations: (startTime?: RelativeTime) => FeatureFlagContext | undefined
getFeatureFlagBytesCount: () => number
addFeatureFlagEvaluation: (key: string, value: ContextValue) => void
stop: () => void
}

/**
Expand All @@ -42,6 +43,7 @@ export function startFeatureFlagContexts(
findFeatureFlagEvaluations: () => undefined,
getFeatureFlagBytesCount: () => 0,
addFeatureFlagEvaluation: noop,
stop: noop,
}
}

Expand All @@ -60,7 +62,7 @@ export function startFeatureFlagContexts(

// Throttle the bytes computation to minimize the impact on performance.
// Especially useful if the user call addFeatureFlagEvaluation API synchronously multiple times in a row
const { throttled: computeBytesCountThrottled } = throttle((context: Context) => {
const { throttled: computeBytesCountThrottled, cancel: cancelPendingComputation } = throttle((context: Context) => {
bytesCountCache = computeBytesCountImpl(jsonStringify(context)!)
if (!alreadyWarned) {
alreadyWarned = warnIfCustomerDataLimitReached(bytesCountCache, CustomerDataType.FeatureFlag)
Expand All @@ -84,5 +86,6 @@ export function startFeatureFlagContexts(
computeBytesCountThrottled(currentContext)
}
},
stop: cancelPendingComputation,
}
}
1 change: 1 addition & 0 deletions packages/rum-core/test/testSetupBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export function setup(): TestSetupBuilder {
let featureFlagContexts: FeatureFlagContexts = {
findFeatureFlagEvaluations: () => undefined,
addFeatureFlagEvaluation: noop,
stop: noop,
getFeatureFlagBytesCount: () => 0,
}
let actionContexts: ActionContexts = {
Expand Down