refactor(core): Use typedi to manage EventBus singletons (no-changelog) (#5795)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-03-29 20:38:47 +02:00
committed by GitHub
parent be373bb859
commit 522c790817
15 changed files with 145 additions and 154 deletions

View File

@@ -4,6 +4,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/naming-convention */
import { Container } from 'typedi';
import { Router } from 'express';
import bodyParser from 'body-parser';
import { v4 as uuid } from 'uuid';
@@ -11,7 +12,7 @@ import config from '@/config';
import * as Db from '@/Db';
import type { Role } from '@db/entities/Role';
import { hashPassword } from '@/UserManagement/UserManagementHelper';
import { eventBus } from '@/eventbus/MessageEventBus/MessageEventBus';
import { MessageEventBus } from '@/eventbus';
if (process.env.E2E_TESTS !== 'true') {
console.error('E2E endpoints only allowed during E2E tests');
@@ -79,6 +80,7 @@ const setupUserManagement = async () => {
const resetLogStreaming = async () => {
config.set('enterprise.features.logStreaming', false);
const eventBus = Container.get(MessageEventBus);
for (const id in eventBus.destinations) {
await eventBus.removeDestination(id);
}