refactor: Revert "refactor(core): Use typedi to manage EventBus singletons (#5795)" (no-changelog) (#5825)
Revert "refactor(core): Use typedi to manage EventBus singletons (no-changelog) (#5795)"
This reverts commit 522c790817.
This commit is contained in:
committed by
GitHub
parent
6c35ffa82c
commit
58fda255fe
@@ -1,24 +1,17 @@
|
||||
import { Container } from 'typedi';
|
||||
import { jsonStringify, LoggerProxy as Logger } from 'n8n-workflow';
|
||||
import type { IPushDataType } from '@/Interfaces';
|
||||
import { MessageEventBus } from '@/eventbus';
|
||||
import { eventBus } from '../eventbus';
|
||||
|
||||
export abstract class AbstractPush<T> {
|
||||
protected connections: Record<string, T> = {};
|
||||
|
||||
protected eventBus: MessageEventBus;
|
||||
|
||||
constructor() {
|
||||
this.eventBus = Container.get(MessageEventBus);
|
||||
}
|
||||
|
||||
protected abstract close(connection: T): void;
|
||||
protected abstract sendToOne(connection: T, data: string): void;
|
||||
|
||||
protected add(sessionId: string, connection: T): void {
|
||||
const { connections } = this;
|
||||
Logger.debug('Add editor-UI session', { sessionId });
|
||||
this.eventBus.emit('editorUiConnected', sessionId);
|
||||
eventBus.emit('editorUiConnected', sessionId);
|
||||
|
||||
const existingConnection = connections[sessionId];
|
||||
if (existingConnection) {
|
||||
|
||||
Reference in New Issue
Block a user