Remove first check delay for expired mute checking
This commit is contained in:
parent
c806e8415a
commit
d54f03361a
1 changed files with 5 additions and 13 deletions
|
@ -59,8 +59,6 @@ const defaultOptions = {
|
|||
};
|
||||
|
||||
const EXPIRED_MUTE_CHECK_INTERVAL = 60 * 1000;
|
||||
let FIRST_CHECK_TIME = Date.now();
|
||||
const FIRST_CHECK_INCREMENT = 5 * 1000;
|
||||
|
||||
export const MutesPlugin = zeppelinGuildPlugin<MutesPluginType>()({
|
||||
name: "mutes",
|
||||
|
@ -115,17 +113,11 @@ export const MutesPlugin = zeppelinGuildPlugin<MutesPluginType>()({
|
|||
},
|
||||
|
||||
afterLoad(pluginData) {
|
||||
// Check for expired mutes every 5s
|
||||
const firstCheckTime = Math.max(Date.now(), FIRST_CHECK_TIME) + FIRST_CHECK_INCREMENT;
|
||||
FIRST_CHECK_TIME = firstCheckTime;
|
||||
|
||||
setTimeout(() => {
|
||||
clearExpiredMutes(pluginData);
|
||||
pluginData.state.muteClearIntervalId = setInterval(
|
||||
() => clearExpiredMutes(pluginData),
|
||||
EXPIRED_MUTE_CHECK_INTERVAL,
|
||||
);
|
||||
}, firstCheckTime - Date.now());
|
||||
clearExpiredMutes(pluginData);
|
||||
pluginData.state.muteClearIntervalId = setInterval(
|
||||
() => clearExpiredMutes(pluginData),
|
||||
EXPIRED_MUTE_CHECK_INTERVAL,
|
||||
);
|
||||
},
|
||||
|
||||
beforeUnload(pluginData) {
|
||||
|
|
Loading…
Add table
Reference in a new issue