Skip to content

Commit

Permalink
chore: remove emitPotentiallyStaleEvents flag (#4537)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Aug 21, 2023
1 parent 6cefb60 commit 68273da
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 28 deletions.
2 changes: 0 additions & 2 deletions src/lib/__snapshots__/create-config.test.ts.snap
Expand Up @@ -78,7 +78,6 @@ exports[`should create default config 1`] = `
"disableNotifications": false,
"embedProxy": true,
"embedProxyFrontend": true,
"emitPotentiallyStaleEvents": false,
"featuresExportImport": true,
"filterInvalidClientMetrics": false,
"frontendNavigationUpdate": false,
Expand Down Expand Up @@ -115,7 +114,6 @@ exports[`should create default config 1`] = `
"disableNotifications": false,
"embedProxy": true,
"embedProxyFrontend": true,
"emitPotentiallyStaleEvents": false,
"featuresExportImport": true,
"filterInvalidClientMetrics": false,
"frontendNavigationUpdate": false,
Expand Down
1 change: 0 additions & 1 deletion src/lib/services/feature-service-potentially-stale.test.ts
Expand Up @@ -44,7 +44,6 @@ test('Should only store events for potentially stale on', async () => {
flagResolver: { isEnabled: () => true },
experimental: {
...(config.experimental ?? {}),
emitPotentiallyStaleEvents: true,
},
} as unknown as IUnleashConfig,
{} as ISegmentService,
Expand Down
36 changes: 17 additions & 19 deletions src/lib/services/feature-toggle-service.ts
Expand Up @@ -2063,25 +2063,23 @@ class FeatureToggleService {
async updatePotentiallyStaleFeatures(): Promise<void> {
const potentiallyStaleFeatures =
await this.featureToggleStore.updatePotentiallyStaleFeatures();
if (this.flagResolver.isEnabled('emitPotentiallyStaleEvents')) {
if (potentiallyStaleFeatures.length > 0) {
return this.eventStore.batchStore(
await Promise.all(
potentiallyStaleFeatures
.filter((feature) => feature.potentiallyStale)
.map(
async ({ name, project }) =>
new PotentiallyStaleOnEvent({
featureName: name,
project,
tags: await this.tagStore.getAllTagsForFeature(
name,
),
}),
),
),
);
}
if (potentiallyStaleFeatures.length > 0) {
return this.eventStore.batchStore(
await Promise.all(
potentiallyStaleFeatures
.filter((feature) => feature.potentiallyStale)
.map(
async ({ name, project }) =>
new PotentiallyStaleOnEvent({
featureName: name,
project,
tags: await this.tagStore.getAllTagsForFeature(
name,
),
}),
),
),
);
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/lib/types/experimental.ts
Expand Up @@ -22,7 +22,6 @@ export type IFlagKey =
| 'advancedPlayground'
| 'strategyVariant'
| 'slackAppAddon'
| 'emitPotentiallyStaleEvents'
| 'configurableFeatureTypeLifetimes'
| 'filterInvalidClientMetrics'
| 'frontendNavigationUpdate'
Expand Down Expand Up @@ -106,10 +105,6 @@ const flags: IFlags = {
process.env.UNLEASH_SLACK_APP_ADDON,
false,
),
emitPotentiallyStaleEvents: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_EMIT_POTENTIALLY_STALE_EVENTS,
false,
),
configurableFeatureTypeLifetimes: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_CONFIGURABLE_FEATURE_TYPE_LIFETIMES,
false,
Expand Down
1 change: 0 additions & 1 deletion src/server-dev.ts
Expand Up @@ -38,7 +38,6 @@ process.nextTick(async () => {
anonymiseEventLog: false,
responseTimeWithAppNameKillSwitch: false,
strategyVariant: true,
emitPotentiallyStaleEvents: true,
slackAppAddon: true,
configurableFeatureTypeLifetimes: true,
frontendNavigationUpdate: true,
Expand Down

0 comments on commit 68273da

Please sign in to comment.