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 upDefer Store Verification #1350
Open
Defer Store Verification #1350
+69
−46
Conversation
431d26f
to
fc59d19
Allow file access before the entire store has been validated. Critical pieces are validated immediately instead of waiting in the parallelLimit() queue.
This avoids confusion with setting an index in _verified[] to true.
This function isn't useful anymore because store verification happens after the 'ready' event.
Specify whether the verification was on a piece in the store, or on a piece from a wire.
This makes metadata always available before every request, and race conditions between verification and downloading aren't possible. Critical pieces are still prioritized for verification.
This comment has been minimized.
This comment has been minimized.
stale
bot
commented
Sep 16, 2018
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
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.
KayleePop commentedApr 12, 2018
•
edited
This PR is to fix the problem demonstrated here: https://jsfiddle.net/1g80d0aj/18/
The entire store needs to be verified before any files in the torrent can be accessed or streamed. This leads to a massive delay in appending the video when using a store with a significant read time instead of the default in-memory store. (this is the indexeddb chunk store used in the demo).
To fix this, I made the 'ready' event fire before store verification finishes, and any calls to _request() are cancelled if that piece hasn't yet been checked for in the store.
Critical pieces are verified immediately instead of being waited for in the parallelLimit() queue,
and requests for critical pieces aren't cancelled before verification like normal pieces. This allows file streams to work as quickly as possible.(EDIT: Critical pieces are now also cancelled before verification)
Here's the same demo but using a minified build from this PR instead of the latest webtorrent build. https://jsfiddle.net/6r2hgxf5/11/
Viewing this one commit at a time might make the changes clearer.