mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
fix(core): Minor improvements to multi-main setup (no-changelog) (#8012)
- Move webhook, poller and trigger activation logs closer to activation event - Enrich response of `/debug/multi-main-setup` - Ensure workflow updates broadcast activation state changes only if state changed - Fix bug on workflow activation after leadership change - Ensure debug controller is not available in production --------- Co-authored-by: Omar Ajoue <krynble@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { ActiveWorkflowRunner } from '@/ActiveWorkflowRunner';
|
||||
import { MultiMainSetup } from '@/services/orchestration/main/MultiMainSetup.ee';
|
||||
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
|
||||
import { In } from 'typeorm';
|
||||
import { WebhookEntity } from '@/databases/entities/WebhookEntity';
|
||||
|
||||
@RestController('/debug')
|
||||
export class DebugController {
|
||||
@@ -16,17 +17,27 @@ export class DebugController {
|
||||
async getMultiMainSetupDetails() {
|
||||
const leaderKey = await this.multiMainSetup.fetchLeaderKey();
|
||||
|
||||
const activeWorkflows = await this.workflowRepository.find({
|
||||
const triggersAndPollers = await this.workflowRepository.find({
|
||||
select: ['id', 'name'],
|
||||
where: { id: In(this.activeWorkflowRunner.allActiveInMemory()) },
|
||||
});
|
||||
|
||||
const webhooks = (await this.workflowRepository
|
||||
.createQueryBuilder('workflow')
|
||||
.select('DISTINCT workflow.id, workflow.name')
|
||||
.innerJoin(WebhookEntity, 'webhook_entity', 'workflow.id = webhook_entity.workflowId')
|
||||
.execute()) as Array<{ id: string; name: string }>;
|
||||
|
||||
const activationErrors = await this.activeWorkflowRunner.getAllWorkflowActivationErrors();
|
||||
|
||||
return {
|
||||
instanceId: this.multiMainSetup.instanceId,
|
||||
leaderKey,
|
||||
activeWorkflows,
|
||||
isLeader: this.multiMainSetup.isLeader,
|
||||
activeWorkflows: {
|
||||
webhooks, // webhook-based active workflows
|
||||
triggersAndPollers, // poller- and trigger-based active workflows
|
||||
},
|
||||
activationErrors,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user