mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Optimizations + debug logging
This commit is contained in:
parent
a84fb87324
commit
6ed8aba35f
3 changed files with 16 additions and 3 deletions
|
@ -53,6 +53,10 @@ export type UnmuteResult = {
|
|||
case: Case;
|
||||
};
|
||||
|
||||
const EXPIRED_MUTE_CHECK_INTERVAL = 60 * 1000;
|
||||
let FIRST_CHECK_TIME = Date.now();
|
||||
const FIRST_CHECK_INCREMENT = 5 * 1000;
|
||||
|
||||
export class MutesPlugin extends ZeppelinPlugin<IMutesPluginConfig> {
|
||||
public static pluginName = "mutes";
|
||||
|
||||
|
@ -99,8 +103,13 @@ export class MutesPlugin extends ZeppelinPlugin<IMutesPluginConfig> {
|
|||
this.serverLogs = new GuildLogs(this.guildId);
|
||||
|
||||
// Check for expired mutes every 5s
|
||||
this.clearExpiredMutes();
|
||||
this.muteClearIntervalId = setInterval(() => this.clearExpiredMutes(), 5000);
|
||||
const firstCheckTime = Math.max(Date.now(), FIRST_CHECK_TIME) + FIRST_CHECK_INCREMENT;
|
||||
FIRST_CHECK_TIME = firstCheckTime;
|
||||
|
||||
setTimeout(() => {
|
||||
this.clearExpiredMutes();
|
||||
this.muteClearIntervalId = setInterval(() => this.clearExpiredMutes(), EXPIRED_MUTE_CHECK_INTERVAL);
|
||||
}, firstCheckTime - Date.now());
|
||||
}
|
||||
|
||||
protected onUnload() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue