refactor(core): Simplify OrchestrationService (no-changelog) (#8364)
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import { Get, RestController } from '@/decorators';
|
||||
import { ActiveWorkflowRunner } from '@/ActiveWorkflowRunner';
|
||||
import { MultiMainSetup } from '@/services/orchestration/main/MultiMainSetup.ee';
|
||||
import { OrchestrationService } from '@/services/orchestration.service';
|
||||
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
|
||||
|
||||
@RestController('/debug')
|
||||
export class DebugController {
|
||||
constructor(
|
||||
private readonly multiMainSetup: MultiMainSetup,
|
||||
private readonly orchestrationService: OrchestrationService,
|
||||
private readonly activeWorkflowRunner: ActiveWorkflowRunner,
|
||||
private readonly workflowRepository: WorkflowRepository,
|
||||
) {}
|
||||
|
||||
@Get('/multi-main-setup')
|
||||
async getMultiMainSetupDetails() {
|
||||
const leaderKey = await this.multiMainSetup.fetchLeaderKey();
|
||||
const leaderKey = await this.orchestrationService.multiMainSetup.fetchLeaderKey();
|
||||
|
||||
const triggersAndPollers = await this.workflowRepository.findIn(
|
||||
this.activeWorkflowRunner.allActiveInMemory(),
|
||||
@@ -24,9 +24,9 @@ export class DebugController {
|
||||
const activationErrors = await this.activeWorkflowRunner.getAllWorkflowActivationErrors();
|
||||
|
||||
return {
|
||||
instanceId: this.multiMainSetup.instanceId,
|
||||
instanceId: this.orchestrationService.instanceId,
|
||||
leaderKey,
|
||||
isLeader: this.multiMainSetup.isLeader,
|
||||
isLeader: this.orchestrationService.isLeader,
|
||||
activeWorkflows: {
|
||||
webhooks, // webhook-based active workflows
|
||||
triggersAndPollers, // poller- and trigger-based active workflows
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Authorized, Post, RestController, RequireGlobalScope } from '@/decorators';
|
||||
import { OrchestrationRequest } from '@/requests';
|
||||
import { SingleMainSetup } from '@/services/orchestration/main/SingleMainSetup';
|
||||
import { OrchestrationService } from '@/services/orchestration.service';
|
||||
import { License } from '@/License';
|
||||
|
||||
@Authorized()
|
||||
@RestController('/orchestration')
|
||||
export class OrchestrationController {
|
||||
constructor(
|
||||
private readonly singleMainSetup: SingleMainSetup,
|
||||
private readonly orchestrationService: OrchestrationService,
|
||||
private readonly licenseService: License,
|
||||
) {}
|
||||
|
||||
@@ -20,20 +20,20 @@ export class OrchestrationController {
|
||||
async getWorkersStatus(req: OrchestrationRequest.Get) {
|
||||
if (!this.licenseService.isWorkerViewLicensed()) return;
|
||||
const id = req.params.id;
|
||||
return await this.singleMainSetup.getWorkerStatus(id);
|
||||
return await this.orchestrationService.getWorkerStatus(id);
|
||||
}
|
||||
|
||||
@RequireGlobalScope('orchestration:read')
|
||||
@Post('/worker/status')
|
||||
async getWorkersStatusAll() {
|
||||
if (!this.licenseService.isWorkerViewLicensed()) return;
|
||||
return await this.singleMainSetup.getWorkerStatus();
|
||||
return await this.orchestrationService.getWorkerStatus();
|
||||
}
|
||||
|
||||
@RequireGlobalScope('orchestration:list')
|
||||
@Post('/worker/ids')
|
||||
async getWorkerIdsAll() {
|
||||
if (!this.licenseService.isWorkerViewLicensed()) return;
|
||||
return await this.singleMainSetup.getWorkerIds();
|
||||
return await this.orchestrationService.getWorkerIds();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user