diff --git a/Dockerfile b/Dockerfile index e67988f..1857c51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,4 +40,4 @@ ENV NODE_ENV=production ENV PORT=9100 EXPOSE 9100 -CMD ["node", "server/dist/index.js"] +CMD ["node", "--max-old-space-size=256", "server/dist/index.js"] diff --git a/server/src/engine/fight-loop.ts b/server/src/engine/fight-loop.ts index 76563e5..c00ed66 100644 --- a/server/src/engine/fight-loop.ts +++ b/server/src/engine/fight-loop.ts @@ -132,6 +132,12 @@ export async function startFightLoop(options: FightLoopOptions = {}): Promise() const MAX_SSE_PER_IP = 5 +// Periodic cleanup of stale reaction data (every 10 minutes) +setInterval(() => { + if (fightReactions.size > 100) { + fightReactions.clear() + } +}, 10 * 60_000) + export function getActiveSSECount(): number { return activeSSECount }