-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Add secrets provider reload and refactor (#7277)
This PR adds a message for queue mode which triggers an external secrets provider reload inside the workers if the configuration has changed on the main instance. It also refactors some of the message handler code to remove cyclic dependencies, as well as remove unnecessary duplicate redis clients inside services (thanks to no more cyclic deps)
- Loading branch information
1 parent
a80abad
commit 53a7502
Showing
10 changed files
with
190 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/cli/src/services/orchestration.handler.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import Container, { Service } from 'typedi'; | ||
import { RedisService } from './redis.service'; | ||
import type { RedisServicePubSubSubscriber } from './redis/RedisServicePubSubSubscriber'; | ||
import { | ||
COMMAND_REDIS_CHANNEL, | ||
EVENT_BUS_REDIS_CHANNEL, | ||
WORKER_RESPONSE_REDIS_CHANNEL, | ||
} from './redis/RedisServiceHelper'; | ||
import { handleWorkerResponseMessage } from './orchestration/handleWorkerResponseMessage'; | ||
import { handleCommandMessage } from './orchestration/handleCommandMessage'; | ||
import { MessageEventBus } from '../eventbus/MessageEventBus/MessageEventBus'; | ||
|
||
@Service() | ||
export class OrchestrationHandlerService { | ||
redisSubscriber: RedisServicePubSubSubscriber; | ||
|
||
constructor(readonly redisService: RedisService) {} | ||
|
||
async init() { | ||
await this.initSubscriber(); | ||
} | ||
|
||
async shutdown() { | ||
await this.redisSubscriber?.destroy(); | ||
} | ||
|
||
private async initSubscriber() { | ||
this.redisSubscriber = await this.redisService.getPubSubSubscriber(); | ||
|
||
await this.redisSubscriber.subscribeToWorkerResponseChannel(); | ||
await this.redisSubscriber.subscribeToCommandChannel(); | ||
await this.redisSubscriber.subscribeToEventLog(); | ||
|
||
this.redisSubscriber.addMessageHandler( | ||
'OrchestrationMessageReceiver', | ||
async (channel: string, messageString: string) => { | ||
if (channel === WORKER_RESPONSE_REDIS_CHANNEL) { | ||
await handleWorkerResponseMessage(messageString); | ||
} else if (channel === COMMAND_REDIS_CHANNEL) { | ||
await handleCommandMessage(messageString); | ||
} else if (channel === EVENT_BUS_REDIS_CHANNEL) { | ||
await Container.get(MessageEventBus).handleRedisEventBusMessage(messageString); | ||
} | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.