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: {
flags: {
useMemoizedActiveTokens: true,
},
},
});

View File

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

View File

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

View File

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