chore: Set the maximum number of listeners that can be registered for events

This commit is contained in:
Davidson Gomes 2024-10-03 16:46:50 -03:00
parent 7ca9bff6e0
commit 1ded6c81ad
3 changed files with 7 additions and 1 deletions

View File

@ -16,6 +16,9 @@ LOG_COLOR=true
# Log Baileys - "fatal" | "error" | "warn" | "info" | "debug" | "trace"
LOG_BAILEYS=error
# Set the maximum number of listeners that can be registered for an event
EVENT_EMITTER_MAX_LISTENERS=50
# Determine how long the instance should be deleted from memory in case of no connection.
# Default time: 5 minutes
# If you don't even want an expiration, enter the value false

View File

@ -3,6 +3,7 @@
### Features
* Sync lost messages on chatwoot
* Set the maximum number of listeners that can be registered for events
### Fixed

View File

@ -1,8 +1,10 @@
import EventEmitter2 from 'eventemitter2';
const maxListeners = parseInt(process.env.EVENT_EMITTER_MAX_LISTENERS, 10) || 50;
export const eventEmitter = new EventEmitter2({
delimiter: '.',
newListener: false,
ignoreErrors: false,
maxListeners: 50,
maxListeners: maxListeners,
});