Avg returns NaN when 1 or more ping attempts fail - added a fix - #12
Open
reganface wants to merge 1 commit into
Open
Avg returns NaN when 1 or more ping attempts fail - added a fix#12reganface wants to merge 1 commit into
reganface wants to merge 1 commit into
Conversation
When some number of ping attemps fail, avg will return Nan. In those cases, success_avg will return the average ping of all successful pings. README has been updated and version bumped to 0.1.2
|
@apaszke Thoughts on merging this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When 1 or more ping attempts fail,
avgin the return object will beNaN, thoughminandmaxare returned correctly. As a backwards compatible way of addressing this, I've added two more properties in the return object:droppedwill show how many of the attempts errored out.success_avgwill return the average of all successful pings, ignoring the errors. If all pings are successful,success_avgandavgwill be equal.Since this is an old project that gets quite a bit of use, I decided to add new properties instead of changing the existing one to avoid breaking changes. It could easily be changed to fix the existing functionality, though.
The version number was updated to
0.1.2andREADME.mdwas updated to show the two new properties in the sample return object.