1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-05 17:53:12 +02:00

[Remix] Cleaning up stale feature flag: useMemoizedActiveTokens with value true

This commit is contained in:
Hendrix Bot 2024-03-14 15:27:18 +00:00
parent 7a3d2d6d87
commit 395cc1035d
4 changed files with 6 additions and 23 deletions

View File

@ -31,7 +31,6 @@ test('Should init api token', async () => {
}, },
experimental: { experimental: {
flags: { flags: {
useMemoizedActiveTokens: true,
}, },
}, },
}); });

View File

@ -35,7 +35,6 @@ import {
extractUsernameFromUser, extractUsernameFromUser,
omitKeys, omitKeys,
} from '../util'; } from '../util';
import EventService from '../features/events/event-service';
const resolveTokenPermissions = (tokenType: string) => { const resolveTokenPermissions = (tokenType: string) => {
if (tokenType === ApiTokenType.ADMIN) { if (tokenType === ApiTokenType.ADMIN) {
@ -86,10 +85,6 @@ export class ApiTokenService {
this.environmentStore = environmentStore; this.environmentStore = environmentStore;
this.flagResolver = config.flagResolver; this.flagResolver = config.flagResolver;
this.logger = config.getLogger('/services/api-token-service.ts'); this.logger = config.getLogger('/services/api-token-service.ts');
if (!this.flagResolver.isEnabled('useMemoizedActiveTokens')) {
// This is probably not needed because the scheduler will run it
this.fetchActiveTokens();
}
this.updateLastSeen(); this.updateLastSeen();
if (config.authentication.initApiTokens.length > 0) { if (config.authentication.initApiTokens.length > 0) {
process.nextTick(async () => process.nextTick(async () =>
@ -128,16 +123,12 @@ export class ApiTokenService {
} }
public async getAllActiveTokens(): Promise<IApiToken[]> { public async getAllActiveTokens(): Promise<IApiToken[]> {
if (this.flagResolver.isEnabled('useMemoizedActiveTokens')) {
if (!this.initialized) { if (!this.initialized) {
// unlikely this will happen but nice to have a fail safe // unlikely this will happen but nice to have a fail safe
this.logger.info('Fetching active tokens before initialized'); this.logger.info('Fetching active tokens before initialized');
await this.fetchActiveTokens(); await this.fetchActiveTokens();
} }
return this.activeTokens; return this.activeTokens;
} else {
return this.store.getAllActive();
}
} }
private async initApiTokens(tokens: ILegacyApiTokenCreate[]) { private async initApiTokens(tokens: ILegacyApiTokenCreate[]) {

View File

@ -45,7 +45,6 @@ export type IFlagKey =
| 'showInactiveUsers' | 'showInactiveUsers'
| 'inMemoryScheduledChangeRequests' | 'inMemoryScheduledChangeRequests'
| 'collectTrafficDataUsage' | 'collectTrafficDataUsage'
| 'useMemoizedActiveTokens'
| 'queryMissingTokens' | 'queryMissingTokens'
| 'userAccessUIEnabled' | 'userAccessUIEnabled'
| 'disableUpdateMaxRevisionId' | 'disableUpdateMaxRevisionId'
@ -229,10 +228,6 @@ const flags: IFlags = {
process.env.UNLEASH_EXPERIMENTAL_SHOW_INACTIVE_USERS, process.env.UNLEASH_EXPERIMENTAL_SHOW_INACTIVE_USERS,
false, false,
), ),
useMemoizedActiveTokens: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_MEMOIZED_ACTIVE_TOKENS,
false,
),
inMemoryScheduledChangeRequests: parseEnvVarBoolean( inMemoryScheduledChangeRequests: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_IN_MEMORY_SCHEDULED_CHANGE_REQUESTS, process.env.UNLEASH_EXPERIMENTAL_IN_MEMORY_SCHEDULED_CHANGE_REQUESTS,
false, false,

View File

@ -5,7 +5,6 @@ import { createTestConfig } from '../../config/test-config';
import { ApiTokenType, IApiToken } from '../../../lib/types/models/api-token'; import { ApiTokenType, IApiToken } from '../../../lib/types/models/api-token';
import { DEFAULT_ENV } from '../../../lib/util/constants'; import { DEFAULT_ENV } from '../../../lib/util/constants';
import { addDays, subDays } from 'date-fns'; import { addDays, subDays } from 'date-fns';
import ProjectService from '../../../lib/features/project/project-service';
import { createProjectService } from '../../../lib/features'; import { createProjectService } from '../../../lib/features';
import { EventService } from '../../../lib/services'; import { EventService } from '../../../lib/services';
import { IUnleashStores } from '../../../lib/types'; import { IUnleashStores } from '../../../lib/types';
@ -20,7 +19,6 @@ beforeAll(async () => {
server: { baseUriPath: '/test' }, server: { baseUriPath: '/test' },
experimental: { experimental: {
flags: { flags: {
useMemoizedActiveTokens: true,
}, },
}, },
}); });