Restart sync on joinLayer for immediate room detection#13
Open
axel-krapotke wants to merge 1 commit intomainfrom
Open
Restart sync on joinLayer for immediate room detection#13axel-krapotke wants to merge 1 commit intomainfrom
axel-krapotke wants to merge 1 commit intomainfrom
Conversation
joinLayer() now follows the sequence: add room to filter (idMapping), restart the sync long-poll, then perform the actual join. This ensures the restarted poll includes the room and sees the join event when it arrives, enabling the sync-gated content fetch to work reliably. Changes: - http-api: pass AbortSignal through to ky for sync requests - timeline-api: add restartSync() to abort current long-poll; stream loop catches the abort and re-enters with updated filter - project: reorder joinLayer() to update filter before join - E2E test: verify sync-gated received() delivers content after join
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.
Problem
After
joinLayer(), the sync-gated content mechanism inProject.start()could not detect the room because the running long-poll'sroomsfilter didn't include it. The poll had to time out (30s) before the next one picked up the updated filter.Solution
Reorder
joinLayer()to follow: filter update → sync restart → joinidMapping(temporary self-mapping) so it appears in theroomsfilterrestartSync()to abort the current long-pollPOST /joinstateEventscheck fires →content()loads operations →received()delivers themImplementation
httpApi.sync(): Accept optionalAbortSignal, pass tokyTimelineAPI.restartSync(): Abort the current iteration'sAbortControllerTimelineAPI.stream(): Per-iterationAbortController, catch abort as restart (not error)Project.joinLayer(): Reordered as described aboveTests
content()+ sync-gatedreceived()(1.5s)