Repository navigation
fix: attach a core first opened by a passive session when an active store gets it - #186
Open
danielAsaboro wants to merge 1 commit into
Open
danielAsaboro wants to merge 1 commit into
danielAsaboro wants to merge 1 commit into
Conversation
[Medium impact] The PR appears safe to merge. SummaryFixes shared cores that remain unattached when a passive store opens them before an active store.
|
This branch has not been deployed
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.
_openCoresetscore.replicator.ondownloadingto checkthis.active, wherethisis the store that created the core. The hook only fires when the core starts downloading. If a passive session (store.session({ active: false })) opens the core first, the hook fires once, seesactive: falseand does nothing. A later session from an active store reuses the core, which is already downloading, so the hook never fires again. The core is never attached to the existing replication streams, andget()on the active session hangs.Now every store that opens the core can mark it active (
core.storeActive), and the hook checks that flag. When an active store reuses a core that is already open and downloading, it attaches it to the streams right away.validation
The new test in
test/basic.jsreplicates from a passive store, opens the core through a passive session and then through the active store. Without the fix,b.get(0)times out withREQUEST_TIMEOUT; with it, it returns the block. Node and Bare 55/55,npm run lintclean.