Skip to content

Commit cd5c42c

Browse files
authored
Merge pull request #110 from the-ress/max-listener-limit
Set the max listener limit to 1000 for `RheaConnection`
2 parents e37362a + c24eb37 commit cd5c42c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/connection.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ export declare interface Connection {
202202
on(event: ConnectionEvents, listener: OnAmqpEvent): this;
203203
}
204204

205+
const maxListenerLimit = 1000;
206+
205207
/**
206208
* Describes the AMQP Connection.
207209
* @class Connection
@@ -256,6 +258,10 @@ export class Connection extends Entity {
256258
this.options.operationTimeoutInSeconds = options?.operationTimeoutInSeconds ?? defaultOperationTimeoutInSeconds;
257259

258260
this._initializeEventListeners();
261+
262+
// Set max listeners on the connection to 1000 because Session and Link add their own listeners
263+
// and the default value of 10 in NodeJS is too low.
264+
this._connection.setMaxListeners(maxListenerLimit);
259265
}
260266

261267
/**

0 commit comments

Comments
 (0)