Skip to content
This repository has been archived by the owner on Aug 23, 2019. It is now read-only.

fix: peer disconnect event and improve logging performance #309

Merged
merged 3 commits into from
Mar 12, 2019

Conversation

jacobheun
Copy link
Contributor

The peer-mux-closed event was being emitted on connection close, even when no muxed connection was established. Since the connect event ,peer-mux-established, is emitted only after muxing, this PR makes the disconnect event in line with the connect event.

This PR also moves any formatting of debug logs into the responsibility of the debugger. The debug module immediately checks whether or not it is enabled for each logger namespace before doing any formatting, and returns early if not. This will prevent unneeded string formatting when debugging is not enabled, which will help improve performance.

chore: clean up logging to prevent unneeded string formating
@ghost ghost assigned jacobheun Mar 9, 2019
@ghost ghost added the in progress label Mar 9, 2019
@jacobheun jacobheun marked this pull request as ready for review March 9, 2019 07:36
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

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

Great work @jacobheun!

LGTM

src/connection/base.js Outdated Show resolved Hide resolved
Copy link
Member

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

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

Code change looks sensible and tests all still pass!

@jacobheun jacobheun merged commit f731cdc into master Mar 12, 2019
@ghost ghost removed the in progress label Mar 12, 2019
@jacobheun jacobheun deleted the fix/connections branch March 12, 2019 08:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants