3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-24 18:15:02 +00:00

Centralize periodic checks for mutes, tempbans, vcalerts, reminders, and scheduled posts

This should result in a significant performance improvement.
The new method is also more precise than the old one, allowing
the aforementioned checks to be performed with second-precision.
This commit is contained in:
Dragory 2021-09-25 21:33:59 +03:00
parent 544363058e
commit 076d69b989
55 changed files with 883 additions and 366 deletions

View file

@ -23,6 +23,11 @@ import { DecayingCounter } from "./utils/DecayingCounter";
import { PluginNotLoadedError } from "knub/dist/plugins/PluginNotLoadedError";
import { logRestCall } from "./restCallStats";
import { logRateLimit } from "./rateLimitStats";
import { runExpiringMutesLoop } from "./data/loops/expiringMutesLoop";
import { runUpcomingRemindersLoop } from "./data/loops/upcomingRemindersLoop";
import { runUpcomingScheduledPostsLoop } from "./data/loops/upcomingScheduledPostsLoop";
import { runExpiringTempbansLoop } from "./data/loops/expiringTempbansLoop";
import { runExpiringVCAlertsLoop } from "./data/loops/expiringVCAlertsLoop";
if (!process.env.KEY) {
// tslint:disable-next-line:no-console
@ -322,6 +327,14 @@ connect().then(async () => {
logRateLimit(data);
});
bot.on("loadingFinished", () => {
runExpiringMutesLoop();
runExpiringTempbansLoop();
runExpiringVCAlertsLoop();
runUpcomingRemindersLoop();
runUpcomingScheduledPostsLoop();
});
bot.initialize();
logger.info("Bot Initialized");
logger.info("Logging in...");