backend: Force initialization of RecordingService instance in dependency injector
This commit is contained in:
parent
10181c69ee
commit
bea36272af
@ -45,12 +45,20 @@ const registerDependencies = () => {
|
||||
container.bind(RedisService).toSelf().inSingletonScope();
|
||||
container.bind(S3Service).toSelf().inSingletonScope();
|
||||
container.bind(RecordingService).toSelf().inSingletonScope();
|
||||
|
||||
container.bind(LivekitWebhookService).toSelf().inSingletonScope();
|
||||
container.bind(GlobalPreferencesService).toSelf().inSingletonScope();
|
||||
container.bind(ParticipantService).toSelf().inSingletonScope();
|
||||
|
||||
container.bind(S3PreferenceStorage).toSelf().inSingletonScope();
|
||||
container.bind(GlobalPreferencesStorageFactory).toSelf().inSingletonScope();
|
||||
|
||||
initializeEagerServices();
|
||||
};
|
||||
|
||||
const initializeEagerServices = () => {
|
||||
// Force the creation of services that need to be initialized at startup
|
||||
container.get(RecordingService);
|
||||
};
|
||||
|
||||
export { injectable, inject } from 'inversify';
|
||||
|
||||
@ -19,7 +19,7 @@ import {
|
||||
recordingRouter,
|
||||
roomRouter
|
||||
} from './routes/index.js';
|
||||
import { GlobalPreferencesService, RoomService } from './services/index.js';
|
||||
import { GlobalPreferencesService } from './services/index.js';
|
||||
import { internalParticipantsRouter } from './routes/participants.routes.js';
|
||||
import cookieParser from 'cookie-parser';
|
||||
|
||||
@ -67,6 +67,7 @@ const createApp = () => {
|
||||
|
||||
const initializeGlobalPreferences = async () => {
|
||||
const globalPreferencesService = container.get(GlobalPreferencesService);
|
||||
// TODO: This should be invoked in the constructor of the service
|
||||
await globalPreferencesService.ensurePreferencesInitialized();
|
||||
};
|
||||
|
||||
@ -81,7 +82,7 @@ const startServer = (app: express.Application) => {
|
||||
chalk.cyanBright(`http://localhost:${SERVER_PORT}${MEET_API_BASE_PATH_V1}/docs`)
|
||||
);
|
||||
logEnvVars();
|
||||
await Promise.all([initializeGlobalPreferences(), container.get(RoomService).initialize()]);
|
||||
await Promise.all([initializeGlobalPreferences()]);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user