From 1e126b64640599c970fc06da0f5e4cfd6c9358ee Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Thu, 9 Nov 2023 11:41:13 +0100 Subject: [PATCH] refactor: remove useless reference --- lib/transports-uws/polling.ts | 2 ++ lib/transports/polling.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/transports-uws/polling.ts b/lib/transports-uws/polling.ts index 4ce6e52f..16e72c00 100644 --- a/lib/transports-uws/polling.ts +++ b/lib/transports-uws/polling.ts @@ -55,6 +55,8 @@ export class Polling extends Transport { */ onRequest(req) { const res = req.res; + // remove the reference to the ServerResponse object (as the first request of the session is kept in memory by default) + req.res = null; if (req.getMethod() === "get") { this.onPollRequest(req, res); diff --git a/lib/transports/polling.ts b/lib/transports/polling.ts index f0edcdc8..e5ea24cf 100644 --- a/lib/transports/polling.ts +++ b/lib/transports/polling.ts @@ -54,6 +54,8 @@ export class Polling extends Transport { */ onRequest(req: IncomingMessage & { res: ServerResponse }) { const res = req.res; + // remove the reference to the ServerResponse object (as the first request of the session is kept in memory by default) + req.res = null; if ("GET" === req.method) { this.onPollRequest(req, res);