From a75a551ce5197b0f5ab0a0f70c5a0284309e6923 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sun, 13 Oct 2019 22:03:06 +0300 Subject: [PATCH] Fix Automod not clearing recent actions, leading to memory leak --- src/plugins/Automod.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/Automod.ts b/src/plugins/Automod.ts index ff86c249..62ca5d00 100644 --- a/src/plugins/Automod.ts +++ b/src/plugins/Automod.ts @@ -515,6 +515,8 @@ export class AutomodPlugin extends ZeppelinPlugin { this.automodQueue = new Queue(); this.recentActions = []; + this.recentActionClearInterval = setInterval(() => this.clearOldRecentActions(), 1 * MINUTES); + this.spamGracePeriods = new Map(); this.spamGracePriodClearInterval = setInterval(() => this.clearExpiredGracePeriods(), 1 * SECONDS); @@ -544,6 +546,7 @@ export class AutomodPlugin extends ZeppelinPlugin { this.savedMessages.events.off("create", this.onMessageCreateFn); clearInterval(this.recentActionClearInterval); clearInterval(this.spamGracePriodClearInterval); + clearInterval(this.recentNicknameChangesClearInterval); } protected evaluateMatchWordsTrigger(trigger: TMatchWordsTrigger, str: string): boolean {