lazy load fat modules, cut WS sizes + start dropping notifications at a certain point

This commit is contained in:
KingKDot
2026-04-17 13:49:06 -05:00
parent 77ddc397a0
commit 4a062e3a19
8 changed files with 61 additions and 23 deletions
@@ -176,6 +176,20 @@ export function createNotificationPluginHandlers(deps: CreateDeps) {
return true;
}
function pruneNotificationRate() {
const notificationConfig = deps.getNotificationConfig();
const spamWindow = Math.max(5000, notificationConfig.spamWindowMs || 60000);
const maxAge = spamWindow * 2;
const now = Date.now();
for (const [key, state] of deps.notificationRate) {
if (now - state.lastSent > maxAge && now - state.windowStart > maxAge) {
deps.notificationRate.delete(key);
}
}
}
setInterval(pruneNotificationRate, 60_000);
function flushPluginEvents(clientId: string, pluginId: string) {
const key = `${clientId}:${pluginId}`;
const list = deps.pendingPluginEvents.get(key);