The connect method adds a new listener to the ON_READY event, but never removes that listener. Since connect is called again in the socket retry logic, a long-running application may trigger the max-listeners warning in node by continuously re-adding the promise listener.
This change disposes of the listener once it has been triggered to prevent this leak.
The
connect
method adds a new listener to theON_READY
event, but never removes that listener. Sinceconnect
is called again in the socket retry logic, a long-running application may trigger the max-listeners warning in node by continuously re-adding the promise listener.This change disposes of the listener once it has been triggered to prevent this leak.