Skip to content

Commit 1ded6c8

Browse files
committed
chore: Set the maximum number of listeners that can be registered for events
1 parent 7ca9bff commit 1ded6c8

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ LOG_COLOR=true
1616
# Log Baileys - "fatal" | "error" | "warn" | "info" | "debug" | "trace"
1717
LOG_BAILEYS=error
1818

19+
# Set the maximum number of listeners that can be registered for an event
20+
EVENT_EMITTER_MAX_LISTENERS=50
21+
1922
# Determine how long the instance should be deleted from memory in case of no connection.
2023
# Default time: 5 minutes
2124
# If you don't even want an expiration, enter the value false

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Features
44

55
* Sync lost messages on chatwoot
6+
* Set the maximum number of listeners that can be registered for events
67

78
### Fixed
89

src/config/event.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import EventEmitter2 from 'eventemitter2';
22

3+
const maxListeners = parseInt(process.env.EVENT_EMITTER_MAX_LISTENERS, 10) || 50;
4+
35
export const eventEmitter = new EventEmitter2({
46
delimiter: '.',
57
newListener: false,
68
ignoreErrors: false,
7-
maxListeners: 50,
9+
maxListeners: maxListeners,
810
});

0 commit comments

Comments
 (0)