1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-24 20:06:55 +01:00

chore: feature flag for startup tasks

This commit is contained in:
David Leek 2024-01-17 15:36:41 +01:00
parent 1392b10727
commit fa16545862
No known key found for this signature in database
GPG Key ID: 515EE0F1BB6D0BE1
2 changed files with 11 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import * as eventType from './types/events';
import { Db } from './db/db';
import { defaultLockKey, defaultTimeout, withDbLock } from './util/db-lock';
import { scheduleServices } from './features/scheduler/schedule-services';
import { scheduleStartupTasks } from './features/startup-tasks/startup-task-runner';
async function createApp(
config: IUnleashConfig,
@ -50,6 +51,10 @@ async function createApp(
await scheduleServices(services);
}
if (config.flagResolver.isEnabled('startupTasks')) {
await scheduleStartupTasks(services);
}
const metricsMonitor = createMetricsMonitor();
const unleashSession = sessionDb(config, db);

View File

@ -44,7 +44,8 @@ export type IFlagKey =
| 'extendedUsageMetrics'
| 'extendedUsageMetricsUI'
| 'adminTokenKillSwitch'
| 'changeRequestConflictHandling';
| 'changeRequestConflictHandling'
| 'startupTasks';
export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;
@ -203,6 +204,10 @@ const flags: IFlags = {
process.env.UNLEASH_EXPERIMENTAL_CHANGE_REQUEST_CONFLICT_HANDLING,
false,
),
startupTasks: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_STARTUP_TASKS,
false,
),
};
export const defaultExperimentalOptions: IExperimentalOptions = {