-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: relay document listeners #6563
Open
bjoerge
wants to merge
13
commits into
next
Choose a base branch
from
sdx-1311/relay-document-listeners
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+658
−80
Conversation
This file contains 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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
No changes to documentation |
Component Testing Report Updated May 13, 2024 11:09 AM (UTC)
|
* fix(studio): adding tooltip to read-only bool inputs * fix(studio): testing for tooltip on boolean read-only inputs * fix(studio): removing memoisation as it was useless
Co-authored-by: juice49 <1454914+juice49@users.noreply.github.com>
* feat: add canHandleIntent to S.component * fix: properly type canHandleIntent * Update packages/sanity/src/structure/structureBuilder/Component.ts Co-authored-by: Ash <ash@sanity.io> --------- Co-authored-by: Ash <ash@sanity.io>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* feat(vision): add download as json/csv buttons * fix(vision): use blob urls for downloads (#6213) * fix(vision): use Translate component to avoid splitting i18n strings * fix(vision): clean up i18n resources for result saving feature --------- Co-authored-by: Espen Hovlandsdal <espen@hovlandsdal.com>
8098363
to
1813dc4
Compare
3cdc78a
to
d466e25
Compare
d466e25
to
32fbe7d
Compare
32fbe7d
to
9acdb1f
Compare
9acdb1f
to
4eedef7
Compare
juice49
reviewed
May 13, 2024
packages/sanity/src/core/store/_legacy/document/createPairListener.ts
Outdated
Show resolved
Hide resolved
juice49
reviewed
May 13, 2024
packages/sanity/src/core/store/_legacy/document/createPairListener.ts
Outdated
Show resolved
Hide resolved
juice49
previously approved these changes
May 14, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
The merge-base changed after approval.
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.
Description
This implements a relay approach for listener connections:
welcome
-event - (in case there’s in-flight messages yet to arrive).These steps are repeated indefinitely (for as long as needed).
What to review
The intervals are currently hard coded, so the best way to test is probably to check out this branch, and edit the values here to something shorter (e.g. 10-20s with 4s overlap) and observe that a new listener is set up before the old one is shut down.
sanity/packages/sanity/src/core/store/_legacy/document/document-pair/checkoutPair.ts
Lines 196 to 202 in 4eedef7
It might be a bit hard to unpack the code, but I believe the logic is correct and there's tests to verify that it behaves correctly.
Since this can potentially make it easier to hit the the max number of concurrent connections allowed by browsers on http/1. I didn't include a config flag to disable this right now, but it should be quite straightforward to add a config flag if we wish to do so. For now, there's a timeout on the second listener that will cancel it if it's not able to connect within a certain time. If this happens, the first listener will keep runnning.
Testing
Added unit tests asserting that:
eventId
worksNotes for release
N/A - It should be transparent for the user.