mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 12:19:09 +00:00
feat(core): Add command to trigger license refresh on workers (#7184)
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.
This commit is contained in:
committed by
GitHub
parent
d317e09c59
commit
9f797b96d8
@@ -32,6 +32,19 @@ export class RedisServicePubSubSubscriber extends RedisServiceBaseReceiver {
|
||||
});
|
||||
}
|
||||
|
||||
async unsubscribe(channel: string): Promise<void> {
|
||||
if (!this.redisClient) {
|
||||
return;
|
||||
}
|
||||
await this.redisClient?.unsubscribe(channel, (error, _count: number) => {
|
||||
if (error) {
|
||||
Logger.error(`Error unsubscribing from channel ${channel}`);
|
||||
} else {
|
||||
Logger.debug(`Unsubscribed Redis PubSub client from channel: ${channel}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async subscribeToEventLog(): Promise<void> {
|
||||
await this.subscribe(EVENT_BUS_REDIS_CHANNEL);
|
||||
}
|
||||
@@ -43,4 +56,16 @@ export class RedisServicePubSubSubscriber extends RedisServiceBaseReceiver {
|
||||
async subscribeToWorkerResponseChannel(): Promise<void> {
|
||||
await this.subscribe(WORKER_RESPONSE_REDIS_CHANNEL);
|
||||
}
|
||||
|
||||
async unSubscribeFromEventLog(): Promise<void> {
|
||||
await this.unsubscribe(EVENT_BUS_REDIS_CHANNEL);
|
||||
}
|
||||
|
||||
async unSubscribeFromCommandChannel(): Promise<void> {
|
||||
await this.unsubscribe(COMMAND_REDIS_CHANNEL);
|
||||
}
|
||||
|
||||
async unSubscribeFromWorkerResponseChannel(): Promise<void> {
|
||||
await this.unsubscribe(WORKER_RESPONSE_REDIS_CHANNEL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user