Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

fix(connection): fixing leak in 3.0.0 #235

Merged
merged 1 commit into from Nov 16, 2017
Merged

fix(connection): fixing leak in 3.0.0 #235

merged 1 commit into from Nov 16, 2017

Conversation

daprahamian
Copy link
Contributor

Adding the fix from #234 to 3.0.0 branch.

Copy link

@jlord jlord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto what @mbroadst just said about adding some tests to repro 👍

expect(connections).to.have.lengthOf(1).and.to.have;
expect(connections[0].connection.listenerCount('connect')).to.equal(1);
_pool.destroy();
Connection.disableConnectionAccounting();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what we actually want to test is that there is a single listener count until connect occurs right? So there should be an initial listener count for that event, and when connect occurs there should be zero listeners. Or am I misunderstanding something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect the listener count to be 0 as well, but there is some listener nestled deep inside of node's core that we don't have control over.

Still, I will refactor to emphasize that the number of listeners for the connection should decrease by 1.

@daprahamian daprahamian merged commit fc669c0 into 3.0.0 Nov 16, 2017
@daprahamian daprahamian deleted the NODE-1116-3.0.0 branch November 16, 2017 19:49
jlord pushed a commit that referenced this pull request Nov 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants