mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
chore: Convert ErrorReporting to a Service to use DI. Add some tests (no-changelog) (#11279)
This commit is contained in:
committed by
GitHub
parent
5300e0ac45
commit
73145b70b8
@@ -12,7 +12,14 @@ describe('JobProcessor', () => {
|
||||
executionRepository.findSingleExecution.mockResolvedValue(
|
||||
mock<IExecutionResponse>({ status: 'crashed' }),
|
||||
);
|
||||
const jobProcessor = new JobProcessor(mock(), executionRepository, mock(), mock(), mock());
|
||||
const jobProcessor = new JobProcessor(
|
||||
mock(),
|
||||
mock(),
|
||||
executionRepository,
|
||||
mock(),
|
||||
mock(),
|
||||
mock(),
|
||||
);
|
||||
|
||||
const result = await jobProcessor.processJob(mock<Job>());
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ describe('ScalingService', () => {
|
||||
scalingService = new ScalingService(
|
||||
mockLogger(),
|
||||
mock(),
|
||||
mock(),
|
||||
jobProcessor,
|
||||
globalConfig,
|
||||
mock(),
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import type { RunningJobSummary } from '@n8n/api-types';
|
||||
import { InstanceSettings, WorkflowExecute } from 'n8n-core';
|
||||
import { ErrorReporter, InstanceSettings, WorkflowExecute } from 'n8n-core';
|
||||
import type { ExecutionStatus, IExecuteResponsePromiseData, IRun } from 'n8n-workflow';
|
||||
import {
|
||||
BINARY_ENCODING,
|
||||
ApplicationError,
|
||||
Workflow,
|
||||
ErrorReporterProxy as ErrorReporter,
|
||||
} from 'n8n-workflow';
|
||||
import { BINARY_ENCODING, ApplicationError, Workflow } from 'n8n-workflow';
|
||||
import type PCancelable from 'p-cancelable';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
@@ -35,6 +30,7 @@ export class JobProcessor {
|
||||
|
||||
constructor(
|
||||
private readonly logger: Logger,
|
||||
private readonly errorReporter: ErrorReporter,
|
||||
private readonly executionRepository: ExecutionRepository,
|
||||
private readonly workflowRepository: WorkflowRepository,
|
||||
private readonly nodeTypes: NodeTypes,
|
||||
@@ -155,7 +151,7 @@ export class JobProcessor {
|
||||
workflowExecute = new WorkflowExecute(additionalData, execution.mode, execution.data);
|
||||
workflowRun = workflowExecute.processRunExecutionData(workflow);
|
||||
} else {
|
||||
ErrorReporter.info(`Worker found execution ${executionId} without data`);
|
||||
this.errorReporter.info(`Worker found execution ${executionId} without data`);
|
||||
// Execute all nodes
|
||||
// Can execute without webhook so go on
|
||||
workflowExecute = new WorkflowExecute(additionalData, execution.mode);
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import { InstanceSettings } from 'n8n-core';
|
||||
import {
|
||||
ApplicationError,
|
||||
BINARY_ENCODING,
|
||||
sleep,
|
||||
jsonStringify,
|
||||
ErrorReporterProxy,
|
||||
ensureError,
|
||||
} from 'n8n-workflow';
|
||||
import { ErrorReporter, InstanceSettings } from 'n8n-core';
|
||||
import { ApplicationError, BINARY_ENCODING, sleep, jsonStringify, ensureError } from 'n8n-workflow';
|
||||
import type { IExecuteResponsePromiseData } from 'n8n-workflow';
|
||||
import { strict } from 'node:assert';
|
||||
import Container, { Service } from 'typedi';
|
||||
@@ -43,6 +36,7 @@ export class ScalingService {
|
||||
|
||||
constructor(
|
||||
private readonly logger: Logger,
|
||||
private readonly errorReporter: ErrorReporter,
|
||||
private readonly activeExecutions: ActiveExecutions,
|
||||
private readonly jobProcessor: JobProcessor,
|
||||
private readonly globalConfig: GlobalConfig,
|
||||
@@ -119,7 +113,7 @@ export class ScalingService {
|
||||
|
||||
await job.progress(msg);
|
||||
|
||||
ErrorReporterProxy.error(error, { executionId });
|
||||
this.errorReporter.error(error, { executionId });
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user