diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-12 21:53:57 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-12 21:53:57 +0200 |
commit | f2e8e2e0311bc343a21c3de94f6a1e908be81c2c (patch) | |
tree | a9c157945c7b8d5429a33513e3979114a2c37c3a /util/src | |
parent | :zap: benchmark tests (diff) | |
download | server-f2e8e2e0311bc343a21c3de94f6a1e908be81c2c.tar.xz |
:zap: improve memory managment
Diffstat (limited to 'util/src')
-rw-r--r-- | util/src/util/Event.ts | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/util/src/util/Event.ts b/util/src/util/Event.ts index bf9547b1..8ed009d5 100644 --- a/util/src/util/Event.ts +++ b/util/src/util/Event.ts @@ -46,7 +46,9 @@ export async function listenEvent(event: string, callback: (event: EventOpts) => } else { const cancel = () => { events.removeListener(event, callback); + events.setMaxListeners(events.getMaxListeners() - 1); }; + events.setMaxListeners(events.getMaxListeners() + 1); events.addListener(event, (opts) => callback({ ...opts, cancel })); return cancel; |