summary refs log tree commit diff
path: root/util/src
diff options
context:
space:
mode:
authorMr2u <46743919+Mr2u@users.noreply.github.com>2021-10-13 19:33:39 +1100
committerGitHub <noreply@github.com>2021-10-13 19:33:39 +1100
commit625853a47ed187c1788d21671e1151b1fa6f68a0 (patch)
treeadf0a01f6aceb59220bf3f366f94a89db48f8b83 /util/src
parentadded route /guilds/:id/prune GET count and POST prune. (diff)
parent:pencil: improve logging (diff)
downloadserver-625853a47ed187c1788d21671e1151b1fa6f68a0.tar.xz
Merge branch 'fosscord:master' into master
Diffstat (limited to 'util/src')
-rw-r--r--util/src/util/Event.ts2
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;