You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module intercepts res.on and remaps it to stream.on. Using res.once("drain", listener) multiple times creates a listener leak because this is essentially what happens:
res.once("drain",listener);// expands to this (see https://github.com/nodejs/node/blob/aec34473a7eddae32e6c359715ce521446066210/lib/events.js#L282-L303)res.on("drain",()=>{res.removeListener("drain",listener);listener();});// but compression intercepts `on`, so you wind up with:stream.on("drain",()=>{res.removeListener("drain",listener);// <-- wrong targetlistener();})
For that same reason, it looks like a listener bound with res.on("drain", listener) can never actually be removed with res.removeListener.