Prevent request Bus instances from creating new IORedis connections
This commit is contained in:
@@ -188,7 +188,7 @@ export class Bus<TEvent extends Event = Event> extends Unit implements EventBus<
|
||||
}
|
||||
|
||||
/** Initialize this event bus. */
|
||||
async up(): Promise<void> {
|
||||
async up(createUpstreamFromConfig = true): Promise<void> {
|
||||
if ( this.isUp ) {
|
||||
this.logging.warn('Attempted to boot more than once. Skipping.')
|
||||
ifDebugging('extollo.bus', () => {
|
||||
@@ -198,12 +198,14 @@ export class Bus<TEvent extends Event = Event> extends Unit implements EventBus<
|
||||
}
|
||||
|
||||
// Read the connectors from the server.bus config and set them up
|
||||
const config = this.config.get('server.bus', {})
|
||||
if ( Array.isArray(config.connectors) ) {
|
||||
for ( const connector of (config.connectors as BusConnectorConfig[]) ) {
|
||||
this.logging.verbose(`Creating bus connection of type: ${connector.type}`)
|
||||
if ( connector.type === 'redis' ) {
|
||||
await this.connect(this.make(RedisBus))
|
||||
if ( createUpstreamFromConfig ) {
|
||||
const config = this.config.get('server.bus', {})
|
||||
if ( Array.isArray(config.connectors) ) {
|
||||
for ( const connector of (config.connectors as BusConnectorConfig[]) ) {
|
||||
this.logging.verbose(`Creating bus connection of type: ${connector.type}`)
|
||||
if ( connector.type === 'redis' ) {
|
||||
await this.connect(this.make(RedisBus))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user