From 68273da213d742903357c265fc3260ca8d933b6c Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Mon, 21 Aug 2023 14:35:35 +0300 Subject: [PATCH] chore: remove emitPotentiallyStaleEvents flag (#4537) --- .../__snapshots__/create-config.test.ts.snap | 2 -- .../feature-service-potentially-stale.test.ts | 1 - src/lib/services/feature-toggle-service.ts | 36 +++++++++---------- src/lib/types/experimental.ts | 5 --- src/server-dev.ts | 1 - 5 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index c734a1569b..bf869b7fb6 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -78,7 +78,6 @@ exports[`should create default config 1`] = ` "disableNotifications": false, "embedProxy": true, "embedProxyFrontend": true, - "emitPotentiallyStaleEvents": false, "featuresExportImport": true, "filterInvalidClientMetrics": false, "frontendNavigationUpdate": false, @@ -115,7 +114,6 @@ exports[`should create default config 1`] = ` "disableNotifications": false, "embedProxy": true, "embedProxyFrontend": true, - "emitPotentiallyStaleEvents": false, "featuresExportImport": true, "filterInvalidClientMetrics": false, "frontendNavigationUpdate": false, diff --git a/src/lib/services/feature-service-potentially-stale.test.ts b/src/lib/services/feature-service-potentially-stale.test.ts index e3cb03adde..c1d25b7d09 100644 --- a/src/lib/services/feature-service-potentially-stale.test.ts +++ b/src/lib/services/feature-service-potentially-stale.test.ts @@ -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, diff --git a/src/lib/services/feature-toggle-service.ts b/src/lib/services/feature-toggle-service.ts index dbaa79d165..40cf990c07 100644 --- a/src/lib/services/feature-toggle-service.ts +++ b/src/lib/services/feature-toggle-service.ts @@ -2063,25 +2063,23 @@ class FeatureToggleService { async updatePotentiallyStaleFeatures(): Promise { 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, + ), + }), + ), + ), + ); } } } diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 5f087186f1..5aa92f515e 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -22,7 +22,6 @@ export type IFlagKey = | 'advancedPlayground' | 'strategyVariant' | 'slackAppAddon' - | 'emitPotentiallyStaleEvents' | 'configurableFeatureTypeLifetimes' | 'filterInvalidClientMetrics' | 'frontendNavigationUpdate' @@ -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, diff --git a/src/server-dev.ts b/src/server-dev.ts index df995522a1..dc76c4bb5c 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -38,7 +38,6 @@ process.nextTick(async () => { anonymiseEventLog: false, responseTimeWithAppNameKillSwitch: false, strategyVariant: true, - emitPotentiallyStaleEvents: true, slackAppAddon: true, configurableFeatureTypeLifetimes: true, frontendNavigationUpdate: true,