Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upFix ratio limit in documentation #1338
Merged
Conversation
The value of ratio isn't limited to 0-1, which can be checked in the two first links below. It probably was a mistake caused by copy-pasting the documentation of "progress", which is limited to 0-1. The commit where this extra info was added is the one in the third link. - https://github.com/webtorrent/webtorrent/blob/b53d224cdea46173ea97dc9eea7eaf5a6e7a55b9/lib/torrent.js#L177-L179 - https://github.com/webtorrent/webtorrent/blob/b53d224cdea46173ea97dc9eea7eaf5a6e7a55b9/index.js#L195-L205 - 6f2e85c As this value is the result of something like `uploaded / max(1, downloaded)` it never get's to `Infinity`, so it's limited by 0 and `uploaded`. Without the ` || 1` part it would be limited between 0 and infinity.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
qgustavor commentedMar 25, 2018
•
edited
The value of ratio isn't limited to 0-1, which can be checked here and here. It probably was a mistake caused by copy-pasting the documentation of "progress", which is limited to 0-1. The commit where this extra info was added is this one.
As this value is the result of something like
uploaded / max(1, downloaded)it never get's toInfinity, so it's limited by 0 anduploaded. Without the|| 1part it would be limited between 0 and infinity.