diff --git a/server/collaboration/ViewsExtension.ts b/server/collaboration/ViewsExtension.ts index 7b5e1ff02..64b31a499 100644 --- a/server/collaboration/ViewsExtension.ts +++ b/server/collaboration/ViewsExtension.ts @@ -70,4 +70,15 @@ export class ViewsExtension implements Extension { this.intervalsBySocket.delete(socketId); } } + + /** + * onDestroy hook + * @param data The destroy payload + */ + async onDestroy() { + this.intervalsBySocket.forEach((interval, socketId) => { + clearInterval(interval); + this.intervalsBySocket.delete(socketId); + }); + } } diff --git a/server/env.ts b/server/env.ts index a22098e27..6190bece2 100644 --- a/server/env.ts +++ b/server/env.ts @@ -541,8 +541,8 @@ export class Environment { this.toOptionalNumber(process.env.RATE_LIMITER_REQUESTS) ?? 1000; /** - * Set max allowed realtime connections in a minute before throttling. Defaults - * to 50 requests/ip/min. + * Set max allowed realtime connections before throttling. Defaults to 50 + * requests/ip/duration window. */ @IsOptional() @IsNumber() diff --git a/server/services/collaboration.ts b/server/services/collaboration.ts index d8e20caf0..4e2c22064 100644 --- a/server/services/collaboration.ts +++ b/server/services/collaboration.ts @@ -34,6 +34,7 @@ export default function init( extensions: [ new Throttle({ throttle: env.RATE_LIMITER_COLLABORATION_REQUESTS, + consideredSeconds: env.RATE_LIMITER_DURATION_WINDOW, // Ban time is defined in minutes banTime: 5, }),