Make WordPress Core


Ignore:
Timestamp:
05/06/2026 05:27:19 AM (4 months ago)
Author:
peterwilsoncc
Message:

REST API/RTC: Fix divergence when two offline users reconnect.

Prevent Real-Time Collaboration sessions from becoming out of sync when an offline editor returns to an online state. The change ensures that the updates are merged rather than discarded when each client is at a different cursor after reconnecting or experiencing slow network conditions.

Reviewed by ramonopoly.
Merges r62298 to the 7.0 branch.

Props alecgeatches, peterwilsoncc, maxschmeling, joefusco.
See #64622.

Location:
branches/7.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/7.0

  • branches/7.0/src/wp-includes/collaboration/class-wp-http-polling-sync-server.php

    r62283 r62304  
    499499                                }
    500500
    501                                 // Reaching this point means there's a newer compaction, so we can
    502                                 // silently ignore this one.
    503                                 return true;
     501                                /*
     502                                 * A newer compaction already advanced the cursor, but we
     503                                 * can not safely drop an update. The incoming bytes still encode
     504                                 * operations other clients may not have seen, so store them as a
     505                                 * regular update. Y.applyUpdateV2 merges state-as-update blobs
     506                                 * idempotently, so overlap with the existing compaction is safe.
     507                                 */
     508                                return $this->add_update( $room, $client_id, self::UPDATE_TYPE_UPDATE, $data );
    504509
    505510                        case self::UPDATE_TYPE_SYNC_STEP1:
Note: See TracChangeset for help on using the changeset viewer.