Prevent request Bus instances from creating new IORedis connections
This commit is contained in:
parent
b42e91533a
commit
351a2e14b8
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@extollo/lib",
|
||||
"version": "0.9.17",
|
||||
"version": "0.9.18",
|
||||
"description": "The framework library that lifts up your code.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -19,7 +19,7 @@ export class InjectRequestEventBusHTTPModule extends HTTPKernelModule {
|
||||
|
||||
public async apply(request: Request): Promise<Request> {
|
||||
const requestBus = this.container().makeNew<Bus>(Bus)
|
||||
await requestBus.up()
|
||||
await requestBus.up(false)
|
||||
await requestBus.connect(this.bus)
|
||||
|
||||
request.purge(Bus).registerProducer(Bus, () => requestBus)
|
||||
|
@ -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,6 +198,7 @@ export class Bus<TEvent extends Event = Event> extends Unit implements EventBus<
|
||||
}
|
||||
|
||||
// Read the connectors from the server.bus config and set them up
|
||||
if ( createUpstreamFromConfig ) {
|
||||
const config = this.config.get('server.bus', {})
|
||||
if ( Array.isArray(config.connectors) ) {
|
||||
for ( const connector of (config.connectors as BusConnectorConfig[]) ) {
|
||||
@ -207,6 +208,7 @@ export class Bus<TEvent extends Event = Event> extends Unit implements EventBus<
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await this.connectors
|
||||
.filter(bus => !bus.isConnected())
|
||||
|
Loading…
Reference in New Issue
Block a user