File size: 1,335 Bytes
aec3094 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | import { WorkflowRepository } from '@n8n/db';
import { Get, RestController } from '@n8n/decorators';
import { InstanceSettings } from 'n8n-core';
import { ActiveWorkflowManager } from '@/active-workflow-manager';
import { MultiMainSetup } from '@/scaling/multi-main-setup.ee';
@RestController('/debug')
export class DebugController {
constructor(
private readonly multiMainSetup: MultiMainSetup,
private readonly activeWorkflowManager: ActiveWorkflowManager,
private readonly workflowRepository: WorkflowRepository,
private readonly instanceSettings: InstanceSettings,
) {}
@Get('/multi-main-setup', { skipAuth: true })
async getMultiMainSetupDetails() {
const leaderKey = await this.multiMainSetup.fetchLeaderKey();
const triggersAndPollers = await this.workflowRepository.findIn(
this.activeWorkflowManager.allActiveInMemory(),
);
const webhooks = await this.workflowRepository.findWebhookBasedActiveWorkflows();
const activationErrors = await this.activeWorkflowManager.getAllWorkflowActivationErrors();
return {
instanceId: this.instanceSettings.instanceId,
leaderKey,
isLeader: this.instanceSettings.isLeader,
activeWorkflows: {
webhooks, // webhook-based active workflows
triggersAndPollers, // poller- and trigger-based active workflows
},
activationErrors,
};
}
}
|