Real Time Collaboration: Introduce filters for the polling intervals.#76518
Real Time Collaboration: Introduce filters for the polling intervals.#76518chriszarate merged 3 commits intotrunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +49 B (0%) Total Size: 8.76 MB
ℹ️ View Unchanged
|
| const POLLING_INTERVAL_BACKGROUND_TAB_IN_MS = applyFilters( | ||
| 'sync.pollingManager.pollingIntervalBackgroundTab', | ||
| 25 * 1000 // 25 seconds | ||
| ) as number; | ||
|
|
||
| const MAX_ERROR_BACKOFF_IN_MS = applyFilters( | ||
| 'sync.pollingManager.pollingIntervalMaxErrorBackoff', | ||
| 30 * 1000 // 30 seconds | ||
| ) as number; | ||
|
|
There was a problem hiding this comment.
Is there value in making these two filterable?
There was a problem hiding this comment.
For error state, probably not.
Maybe for inactive tabs it might be useful if we allow the awareness timeout to be filtered in wp-dev. Do you think that would be helpful to do?
There was a problem hiding this comment.
Maybe for inactive tabs it might be useful if we allow the awareness timeout to be filtered in wp-dev. Do you think that would be helpful to do?
If we did add a server-side filter, ideally we would localize this script to inject the filtered value so that we could set POLLING_INTERVAL_BACKGROUND_TAB_IN_MS to {awareness timeout} – 5000. A separate client-side filter seems like it would lead to user confusion.
That said, I'm not sure a server-side filter provides much value. It also complicates expectations around cleanup.
The awareness timeout value of 30s is the same across multiple Yjs providers and are generally not configurable. Example:
46b248e to
1e26a7e
Compare
|
Flaky tests detected in 616b147. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23250618006
|
Introduces four filters for the polling intervals in the real time collaboration client: * `sync.pollingManager.pollingIntervalNoCollaborators` the interval in milliseconds when there are no collaborators in the room * `sync.pollingManager.pollingIntervalWithCollaborators` the interval in milliseconds when there are collaborators in the room
1e26a7e to
15bfe71
Compare
|
I've rebased this PR with just these two filters: If we desire additional filters, we can open in a different PR. |
…#76518) * Introduce filters for the RTC polling intervals. Introduces four filters for the polling intervals in the real time collaboration client: * `sync.pollingManager.pollingIntervalNoCollaborators` the interval in milliseconds when there are no collaborators in the room * `sync.pollingManager.pollingIntervalWithCollaborators` the interval in milliseconds when there are collaborators in the room * Remove background tab interval filter * Match filter to constant name --------- Co-authored-by: peterwilsoncc <[email protected]> Co-authored-by: chriszarate <[email protected]>
|
I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: afc01c3 |
This updates the pinned hash from the `gutenberg` from `8c78d87453509661a9f28f978ba2c242d515563b` to `487a096a9782ba6110a7686d7b4b2d0c55ed1b06`. The following changes are included: - Disables anchor support for the Page Break block. (WordPress/gutenberg#76434) - WP Admin: Update Connectors screen footer text for consistency. (WordPress/gutenberg#76382) - E2E Tests: Add coverage for AI plugin callout banner on Connectors page (WordPress/gutenberg#76432) - Update sync docs (WordPress/gutenberg#75972) - RTC: Add preference for collaborator notifications (WordPress/gutenberg#76460) - Fix "should undo bold" flaky test (WordPress/gutenberg#76464) - TimePicker: Clamp month day to valid day for month (WordPress/gutenberg#76400) - RTC: Fix error when entity record doesn't have 'meta' property (WordPress/gutenberg#76311) - Navigation: Update close button size. (WordPress/gutenberg#76482) - TemplateContentPanel: fix useSelect warning (WordPress/gutenberg#76421) - DataViews: Add spinner in `DataViewsLayout` in initial load of data (WordPress/gutenberg#76486) (WordPress/gutenberg#76490) - RTC: Fix TypeError in areEditorStatesEqual when selection is undefined (WordPress/gutenberg#76163) - Page/Post Content Focus Mode: Fix insertion into Post Content block (WordPress/gutenberg#76477) - Revisions: use useSubRegistry={false} to fix global store selectors (WordPress/gutenberg#76152) (WordPress/gutenberg#76522) - Fix RTL styling on Connectors, Font Library, and boot-based admin pages (WordPress/gutenberg#76496) - RTC: Auto-register custom taxonomy rest_base values for CRDT sync (WordPress/gutenberg#75983) - RTC: Add a limit for the default provider (WordPress/gutenberg#76437) - Fix RTL styling on AI plugin callout banner (WordPress/gutenberg#76497) - Add command palette trigger button to admin bar (WordPress/gutenberg#75757) - Block Bindings: Remove source items constrained by enums (WordPress/gutenberg#76200) - HTML Block: Remove "unsaved changes" check (WordPress/gutenberg#76086) - CI: Don't build release notes during plugin build workflow for WP Core sync (WordPress/gutenberg#76398) (WordPress/gutenberg#76578) - CI: Simplify strategy matrix in Build Gutenberg Plugin Zip workflow (WordPress/gutenberg#76435) (WordPress/gutenberg#76538) - Media: Add hooks and extension points for client-side media processing (WordPress/gutenberg#74913) - RTC: Fix list sidebar reset during real-time collaboration (WordPress/gutenberg#76025) - RTC: Fix CRDT serialization of nested RichText attributes (WordPress/gutenberg#76597) - RTC: Remove post list lock icon and replace user-specific lock text (WordPress/gutenberg#76322) - Fix HEIC upload error handling and sub-size format (WordPress/gutenberg#76514) - RTC: Fix cursor index sync with rich text formatting (WordPress/gutenberg#76418) - RTC: Allow filtering of `SyncConnectionModal` (WordPress/gutenberg#76554) - RTC: Implement front-end peer limits (WordPress/gutenberg#76565) - Navigation overlay close button may be displayed twice (WordPress/gutenberg#76585) - Site Editor > Templates: fix author filter (WordPress/gutenberg#76625) - Revisions: Show changed block attributes in inspector sidebar (WordPress/gutenberg#76550) - Fix IS_GUTENBERG_PLUGIN env var override in build config (WordPress/gutenberg#76605) - Real Time Collaboration: Introduce filters for the polling intervals. (WordPress/gutenberg#76518) - RTC: Fix RichTextData deserialization (WordPress/gutenberg#76607) - Cross Origin Isolation: Remove `img` from the list of elements that get mutated (WordPress/gutenberg#76618) - RTC: Scroll to collaborator on click (WordPress/gutenberg#76561) - Update changelog link for pull request 11276 (WordPress/gutenberg#76638) - Fix backport changelog filename (WordPress/gutenberg#76651) - Build: Skip non-minified build for WASM-inlined workers (WordPress/gutenberg#76615) - RTC: Change RTC option name (WordPress/gutenberg#76643) - BlockListBlock: fix crash when selectedProps are null (WordPress/gutenberg#75826) - Build: Fix vips worker 404 when SCRIPT_DEBUG is true (WordPress/gutenberg#76657) - useMediaQuery: support in-iframe queries via new `WindowContext` (WordPress/gutenberg#76446) (WordPress/gutenberg#76660) - Refactor admin-ui Page component to use @wordpress/theme tokens and @wordpress/ui layout primitive (WordPress/gutenberg#75963) - Connectors: Improve accessibility (WordPress/gutenberg#76456) - Build: Remove unused JXL WASM module from vips worker (WordPress/gutenberg#76639) - Connectors: fix button size (WordPress/gutenberg#76582) - Compose: Implement useCopyToClipboard and useCopyOnClick with native clipboard API (WordPress/gutenberg#75723) (WordPress/gutenberg#76663) - Connectors: Fetch specific plugin instead of all plugins (WordPress/gutenberg#76594) - Revisions: Add Meta fields diff panel to document sidebar (WordPress/gutenberg#76341) - Loosen client-side media processing requirements (WordPress/gutenberg#76616) - Reduce the added halo for selected block. (WordPress/gutenberg#76619) - Connectors: Add unregisterConnector and upsert support (WordPress/gutenberg#76541) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/8c78d87453509661a9f28f978ba2c242d515563b…487a096a9782ba6110a7686d7b4b2d0c55ed1b06. Log created with: git log --reverse --format="- %s" 8c78d87453509661a9f28f978ba2c242d515563b..487a096a9782ba6110a7686d7b4b2d0c55ed1b06 | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. git-svn-id: https://develop.svn.wordpress.org/trunk@62063 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned hash from the `gutenberg` from `8c78d87453509661a9f28f978ba2c242d515563b` to `487a096a9782ba6110a7686d7b4b2d0c55ed1b06`. The following changes are included: - Disables anchor support for the Page Break block. (WordPress/gutenberg#76434) - WP Admin: Update Connectors screen footer text for consistency. (WordPress/gutenberg#76382) - E2E Tests: Add coverage for AI plugin callout banner on Connectors page (WordPress/gutenberg#76432) - Update sync docs (WordPress/gutenberg#75972) - RTC: Add preference for collaborator notifications (WordPress/gutenberg#76460) - Fix "should undo bold" flaky test (WordPress/gutenberg#76464) - TimePicker: Clamp month day to valid day for month (WordPress/gutenberg#76400) - RTC: Fix error when entity record doesn't have 'meta' property (WordPress/gutenberg#76311) - Navigation: Update close button size. (WordPress/gutenberg#76482) - TemplateContentPanel: fix useSelect warning (WordPress/gutenberg#76421) - DataViews: Add spinner in `DataViewsLayout` in initial load of data (WordPress/gutenberg#76486) (WordPress/gutenberg#76490) - RTC: Fix TypeError in areEditorStatesEqual when selection is undefined (WordPress/gutenberg#76163) - Page/Post Content Focus Mode: Fix insertion into Post Content block (WordPress/gutenberg#76477) - Revisions: use useSubRegistry={false} to fix global store selectors (WordPress/gutenberg#76152) (WordPress/gutenberg#76522) - Fix RTL styling on Connectors, Font Library, and boot-based admin pages (WordPress/gutenberg#76496) - RTC: Auto-register custom taxonomy rest_base values for CRDT sync (WordPress/gutenberg#75983) - RTC: Add a limit for the default provider (WordPress/gutenberg#76437) - Fix RTL styling on AI plugin callout banner (WordPress/gutenberg#76497) - Add command palette trigger button to admin bar (WordPress/gutenberg#75757) - Block Bindings: Remove source items constrained by enums (WordPress/gutenberg#76200) - HTML Block: Remove "unsaved changes" check (WordPress/gutenberg#76086) - CI: Don't build release notes during plugin build workflow for WP Core sync (WordPress/gutenberg#76398) (WordPress/gutenberg#76578) - CI: Simplify strategy matrix in Build Gutenberg Plugin Zip workflow (WordPress/gutenberg#76435) (WordPress/gutenberg#76538) - Media: Add hooks and extension points for client-side media processing (WordPress/gutenberg#74913) - RTC: Fix list sidebar reset during real-time collaboration (WordPress/gutenberg#76025) - RTC: Fix CRDT serialization of nested RichText attributes (WordPress/gutenberg#76597) - RTC: Remove post list lock icon and replace user-specific lock text (WordPress/gutenberg#76322) - Fix HEIC upload error handling and sub-size format (WordPress/gutenberg#76514) - RTC: Fix cursor index sync with rich text formatting (WordPress/gutenberg#76418) - RTC: Allow filtering of `SyncConnectionModal` (WordPress/gutenberg#76554) - RTC: Implement front-end peer limits (WordPress/gutenberg#76565) - Navigation overlay close button may be displayed twice (WordPress/gutenberg#76585) - Site Editor > Templates: fix author filter (WordPress/gutenberg#76625) - Revisions: Show changed block attributes in inspector sidebar (WordPress/gutenberg#76550) - Fix IS_GUTENBERG_PLUGIN env var override in build config (WordPress/gutenberg#76605) - Real Time Collaboration: Introduce filters for the polling intervals. (WordPress/gutenberg#76518) - RTC: Fix RichTextData deserialization (WordPress/gutenberg#76607) - Cross Origin Isolation: Remove `img` from the list of elements that get mutated (WordPress/gutenberg#76618) - RTC: Scroll to collaborator on click (WordPress/gutenberg#76561) - Update changelog link for pull request 11276 (WordPress/gutenberg#76638) - Fix backport changelog filename (WordPress/gutenberg#76651) - Build: Skip non-minified build for WASM-inlined workers (WordPress/gutenberg#76615) - RTC: Change RTC option name (WordPress/gutenberg#76643) - BlockListBlock: fix crash when selectedProps are null (WordPress/gutenberg#75826) - Build: Fix vips worker 404 when SCRIPT_DEBUG is true (WordPress/gutenberg#76657) - useMediaQuery: support in-iframe queries via new `WindowContext` (WordPress/gutenberg#76446) (WordPress/gutenberg#76660) - Refactor admin-ui Page component to use @wordpress/theme tokens and @wordpress/ui layout primitive (WordPress/gutenberg#75963) - Connectors: Improve accessibility (WordPress/gutenberg#76456) - Build: Remove unused JXL WASM module from vips worker (WordPress/gutenberg#76639) - Connectors: fix button size (WordPress/gutenberg#76582) - Compose: Implement useCopyToClipboard and useCopyOnClick with native clipboard API (WordPress/gutenberg#75723) (WordPress/gutenberg#76663) - Connectors: Fetch specific plugin instead of all plugins (WordPress/gutenberg#76594) - Revisions: Add Meta fields diff panel to document sidebar (WordPress/gutenberg#76341) - Loosen client-side media processing requirements (WordPress/gutenberg#76616) - Reduce the added halo for selected block. (WordPress/gutenberg#76619) - Connectors: Add unregisterConnector and upsert support (WordPress/gutenberg#76541) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/8c78d87453509661a9f28f978ba2c242d515563b…487a096a9782ba6110a7686d7b4b2d0c55ed1b06. Log created with: git log --reverse --format="- %s" 8c78d87453509661a9f28f978ba2c242d515563b..487a096a9782ba6110a7686d7b4b2d0c55ed1b06 | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. Built from https://develop.svn.wordpress.org/trunk@62063 git-svn-id: http://core.svn.wordpress.org/trunk@61345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
I just cherry-picked this PR to the release/22.8 branch to get it included in the next release: c8837667c8c |
…WordPress#76518) * Introduce filters for the RTC polling intervals. Introduces four filters for the polling intervals in the real time collaboration client: * `sync.pollingManager.pollingIntervalNoCollaborators` the interval in milliseconds when there are no collaborators in the room * `sync.pollingManager.pollingIntervalWithCollaborators` the interval in milliseconds when there are collaborators in the room * Remove background tab interval filter * Match filter to constant name --------- Co-authored-by: peterwilsoncc <[email protected]> Co-authored-by: chriszarate <[email protected]>
* Real Time Collaboration: Introduce filters for the polling intervals. (#76518) * Introduce filters for the RTC polling intervals. Introduces four filters for the polling intervals in the real time collaboration client: * `sync.pollingManager.pollingIntervalNoCollaborators` the interval in milliseconds when there are no collaborators in the room * `sync.pollingManager.pollingIntervalWithCollaborators` the interval in milliseconds when there are collaborators in the room * Remove background tab interval filter * Match filter to constant name --------- Co-authored-by: peterwilsoncc <[email protected]> Co-authored-by: chriszarate <[email protected]> * RTC: Fix RichTextData deserialization (#76607) * Add failing unit test for RichTextData conversion * Fix RichText attribute type via deserializeBlockAttributes() call in getPostChangesFromCRDTDoc() * Add test for nested RichText value * Modify deserializeAttributeValue() to recurse arrays and object, using block schema for deeply nested strings * Remove deserializeBlockAttributeValues to avoid 3 different deserialization functions * Add factory wrapper for rich text cache, testing Co-authored-by: alecgeatches <[email protected]> Co-authored-by: chriszarate <[email protected]> Co-authored-by: ingeniumed <[email protected]> * RTC: Scroll to collaborator on click (#76561) * Add createCursorRegistry factory and use it for scrolling to cursors * Use createCursorRegistry for scrolling * Localize spoken scroll to cursor announcement * Merge two matching conditionals * Use removeAll in cursor registry ------ Co-authored-by: maxschmeling <[email protected]> Co-authored-by: ingeniumed <[email protected]> * RTC: Change RTC option name (#76643) * Change RTC option name * Add backport changelog * Restore option migration * Cover previous option name in setCollaboration * Respect previous value in setting injection * Update migration const * Temporary bridge Co-authored-by: chriszarate <[email protected]> Co-authored-by: sc0ttkclark <[email protected]> Co-authored-by: maxschmeling <[email protected]> Co-authored-by: ingeniumed <[email protected]> * RTC: Backport race condition fix (#76649) * Backport race condition fix * Add backport changelog entry * RTC: Increase polling intervals, increase polling on primary room only (#76704) * Bump polling intervals up by 4x * Reset `hasCollaborators` flag on awareness check * Use the first registered room as the primaryRoom, and only pay attention to awareness results from that entity to avoid poll increases from shared entities like categores * Simplify primaryRoom and enforceConnectionLimit * Fix the collaboration utility setup for collaboration tests --------- Co-authored-by: alecgeatches <[email protected]> Co-authored-by: ingeniumed <[email protected]> Co-authored-by: chriszarate <[email protected]> Co-authored-by: t-hamano <[email protected]> * RTC: Use activation hook to enable RTC by default (#76736) * Use activation hook to enable RTC by default * Fix plugin file reference * Directly hook into the `activate_` function for enabling collaboration * Add PR backport for opt-in change --------- Co-authored-by: Alec Geatches <[email protected]> * RTC: Add E2E "stress test" with complex interactions (#76055) * Add RTC E2E "stress test" with complex interactions * Refactor collab utils to work for n users instead of just 2 users * Attempting to fix the timeout, as well as the text insertion being slightly off * insert the test rather than sequentially type it * Respect the collaborators limit of 3 * Switch the type to insertText * Remove refresh as that causes editor limit exceeded * Check Gamma's movement --------- Co-authored-by: chriszarate <[email protected]> Co-authored-by: ingeniumed <[email protected]> Co-authored-by: shekharnwagh <[email protected]> * RTC: Use prepared queries instead of `*_post_meta` functions (#76779) ## What? Use prepared queries instead of `*_post_meta` functions. ## Why? Backport of WordPress/wordpress-develop#11325. Prevents post and post meta cache invalidation when RTC requests are handled. - See: https://core.trac.wordpress.org/ticket/64696 - See: https://core.trac.wordpress.org/ticket/64916 * RTC: Remove stale wp_enable_real_time_collaboration option check (#76810) Co-authored-by: shekharnwagh <[email protected]> Co-authored-by: chriszarate <[email protected]> * RTC: Fix editor freeze when replacing code editor content (#76815) * Add failing performance test for huge code editor changes * Use diffLines() when strings are > 10_000 characters * Handle diffLines in diffWithCursor() when cursor information is sent. We don't care about the cursor for huge performance-sensitive updates * Explicitly use "primary" instead of "meta" key * Revert "Explicitly use "primary" instead of "meta" key" This reverts commit 33e7aba. * Fix paste keys for CI, lower timeouts * Remove console.log Co-authored-by: alecgeatches <[email protected]> Co-authored-by: chriszarate <[email protected]> * Preferences: Hide collaboration options when RTC is not enabled (#76819) * Preferences: Hide collaboration options when RTC is not enabled Only show the "Show avatar in blocks" and "Show collaboration notifications" preference controls when real-time collaboration is actually enabled for the current post. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * Preferences: Consolidate editorStore select call Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: t-hamano <[email protected]> Co-authored-by: chriszarate <[email protected]> * Fix navigation block rendering unit test (#76685) * Fix navigation block rendering unit test * Remove semicolon Co-authored-by: t-hamano <[email protected]> Co-authored-by: westonruter <[email protected]> * Fix navigation block unit test and e2e test (#76692) * Fix navigation block rendering unit test (second try) * Fix e2e test * Revert unncessary change --------- Co-authored-by: Peter Wilson <[email protected]> Co-authored-by: peterwilsoncc <[email protected]> Co-authored-by: chriszarate <[email protected]> Co-authored-by: Alec Geatches <[email protected]> Co-authored-by: alecgeatches <[email protected]> Co-authored-by: ingeniumed <[email protected]> Co-authored-by: Max Schmeling <[email protected]> Co-authored-by: maxschmeling <[email protected]> Co-authored-by: Chris Zarate <[email protected]> Co-authored-by: sc0ttkclark <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: shekharnwagh <[email protected]> Co-authored-by: Shekhar Wagh <[email protected]> Co-authored-by: Aki Hamano <[email protected]> Co-authored-by: westonruter <[email protected]>
What?
Introduces JavaScript filters to allow third party developers to slow down or speed up polling via the RTC client.
Closes #76517
Why?
The default settings are quite fast (up to four times per second) and this frequency may end up causing people to DDOS themselves on discount hosting.
How?
Introduces four filters for the polling intervals in the real time collaboration client:
sync.pollingManager.pollingIntervalNoCollaboratorsthe interval in milliseconds when there are no collaborators in the roomsync.pollingManager.pollingIntervalWithCollaboratorsthe interval in milliseconds when there are collaborators in the roomsync.pollingManager.pollingIntervalMaxErrorBackoffthe maximum polling interval in milliseconds when there are network or other errors preventing syncing from taking placesync.pollingManager.pollingIntervalBackgroundTabthe polling interval when the editor is in the background (use is in another tab or screen saver active)Testing Instructions
Testing Instructions for Keyboard
N/A
Screenshots or screencast
N/A
Use of AI Tools
Nil.
(Co-pilot tried to help via VS Code with some type-ahead but it really didn't.