1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00
unleash.unleash/src/lib/features/events/createEventsService.ts
David Leek 02b3805ca6
Feat/configure scheduled created by migration (#6821)
## About the changes

- Removes the feature flag for the created_by migrations.
- Adds a configuration option in IServerOption for
`ENABLE_SCHEDULED_CREATED_BY_MIGRATION` that defaults to `false`
- the new configuration option when set on startup enables scheduling of
the two created_by migration services (features+events)
- Removes the dependency on flag provider in EventStore as it's no
longer needed
- Adds a brief description of the new configuration option in
`configuring-unleash.md`
- Sets the events created_by migration interval to 15 minutes, up from
2.

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2024-04-10 14:12:58 +02:00

28 lines
1.0 KiB
TypeScript

import FakeEventStore from '../../../test/fixtures/fake-event-store';
import FakeFeatureTagStore from '../../../test/fixtures/fake-feature-tag-store';
import type { Db } from '../../db/db';
import EventStore from './event-store';
import FeatureTagStore from '../../db/feature-tag-store';
import { EventService } from '../../services';
import type { IUnleashConfig } from '../../types';
export const createEventsService: (
db: Db,
config: IUnleashConfig,
) => EventService = (db, config) => {
const eventStore = new EventStore(db, config.getLogger);
const featureTagStore = new FeatureTagStore(
db,
config.eventBus,
config.getLogger,
);
return new EventService({ eventStore, featureTagStore }, config);
};
export const createFakeEventsService: (config: IUnleashConfig) => EventService =
(config) => {
const eventStore = new FakeEventStore();
const featureTagStore = new FakeFeatureTagStore();
return new EventService({ eventStore, featureTagStore }, config);
};