mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
This PR implements the updated license SDK so that worker and webhook instances do not auto-renew licenses any more. Instead, they receive a `reloadLicense` command via the Redis client that will fetch the updated license after it was saved on the main instance This also contains some refactoring with moving redis sub and pub clients into the event bus directly, to prevent cyclic dependency issues.
60 lines
1.3 KiB
TypeScript
60 lines
1.3 KiB
TypeScript
export type RedisServiceCommand =
|
|
| 'getStatus'
|
|
| 'getId'
|
|
| 'restartEventBus'
|
|
| 'stopWorker'
|
|
| 'reloadLicense';
|
|
|
|
/**
|
|
* An object to be sent via Redis pub/sub from the main process to the workers.
|
|
* @field command: The command to be executed.
|
|
* @field targets: The targets to execute the command on. Leave empty to execute on all workers or specify worker ids.
|
|
* @field payload: Optional arguments to be sent with the command.
|
|
*/
|
|
type RedisServiceBaseCommand = {
|
|
senderId?: string;
|
|
command: RedisServiceCommand;
|
|
payload?: {
|
|
[key: string]: string | number | boolean | string[] | number[] | boolean[];
|
|
};
|
|
};
|
|
|
|
export type RedisServiceWorkerResponseObject = {
|
|
workerId: string;
|
|
} & (
|
|
| RedisServiceBaseCommand
|
|
| {
|
|
command: 'getStatus';
|
|
payload: {
|
|
workerId: string;
|
|
runningJobs: string[];
|
|
freeMem: number;
|
|
totalMem: number;
|
|
uptime: number;
|
|
loadAvg: number[];
|
|
cpus: string[];
|
|
arch: string;
|
|
platform: NodeJS.Platform;
|
|
hostname: string;
|
|
net: string[];
|
|
};
|
|
}
|
|
| {
|
|
command: 'getId';
|
|
}
|
|
| {
|
|
command: 'restartEventBus';
|
|
payload: {
|
|
result: 'success' | 'error';
|
|
error?: string;
|
|
};
|
|
}
|
|
| {
|
|
command: 'stopWorker';
|
|
}
|
|
);
|
|
|
|
export type RedisServiceCommandObject = {
|
|
targets?: string[];
|
|
} & RedisServiceBaseCommand;
|