refactor(core): Refactor WorkflowStatistics code (no-changelog) (#6617)

refactor(core): Refactor WorkflowStatistics code
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-07-18 11:28:24 +02:00
committed by GitHub
parent e7091d6726
commit f4a18ba87d
20 changed files with 432 additions and 571 deletions

View File

@@ -17,8 +17,9 @@ import type express from 'express';
import get from 'lodash/get';
import stream from 'stream';
import { promisify } from 'util';
import { Container } from 'typedi';
import { BinaryDataManager, NodeExecuteFunctions, eventEmitter } from 'n8n-core';
import { BinaryDataManager, NodeExecuteFunctions } from 'n8n-core';
import type {
IBinaryData,
@@ -60,7 +61,7 @@ import { ActiveExecutions } from '@/ActiveExecutions';
import type { User } from '@db/entities/User';
import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
import { getWorkflowOwner } from '@/UserManagement/UserManagementHelper';
import { Container } from 'typedi';
import { EventsService } from '@/services/events.service';
const pipeline = promisify(stream.pipeline);
@@ -243,7 +244,7 @@ export async function executeWebhook(
NodeExecuteFunctions,
executionMode,
);
eventEmitter.emit(eventEmitter.types.nodeFetchedData, workflow.id, workflowStartNode);
Container.get(EventsService).emit('nodeFetchedData', workflow.id, workflowStartNode);
} catch (err) {
// Send error response to webhook caller
const errorMessage = 'Workflow Webhook Error: Workflow could not be started!';