mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-06-09 08:53:57 +02:00
442c73e63b
https://linear.app/n8n/issue/PAY-933/set-up-leader-selection-for-multiple-main-instances - [x] Set up new envs - [x] Add config and license checks - [x] Implement `MultiMainInstancePublisher` - [x] Expand `RedisServicePubSubPublisher` to support `MultiMainInstancePublisher` - [x] Init `MultiMainInstancePublisher` on startup and destroy on shutdown - [x] Add to sandbox plans - [x] Test manually Note: This is only for setup - coordinating in reaction to leadership changes will come in later PRs.
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { Authorized, Get, RestController } from '@/decorators';
|
|
import { OrchestrationRequest } from '@/requests';
|
|
import { Service } from 'typedi';
|
|
import { SingleMainInstancePublisher } from '@/services/orchestration/main/SingleMainInstance.publisher';
|
|
|
|
@Authorized(['global', 'owner'])
|
|
@RestController('/orchestration')
|
|
@Service()
|
|
export class OrchestrationController {
|
|
constructor(private readonly orchestrationService: SingleMainInstancePublisher) {}
|
|
|
|
/**
|
|
* These endpoint currently do not return anything, they just trigger the messsage to
|
|
* the workers to respond on Redis with their status.
|
|
* TODO: these responses need to be forwarded to and handled by the frontend
|
|
*/
|
|
@Get('/worker/status/:id')
|
|
async getWorkersStatus(req: OrchestrationRequest.Get) {
|
|
const id = req.params.id;
|
|
return this.orchestrationService.getWorkerStatus(id);
|
|
}
|
|
|
|
@Get('/worker/status')
|
|
async getWorkersStatusAll() {
|
|
return this.orchestrationService.getWorkerStatus();
|
|
}
|
|
|
|
@Get('/worker/ids')
|
|
async getWorkerIdsAll() {
|
|
return this.orchestrationService.getWorkerIds();
|
|
}
|
|
}
|