Skip to content

Commit c9db793

Browse files
committed
Compare state during updates.
1 parent 63c1315 commit c9db793

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/wp-includes/collaboration/class-wp-collaboration-table-storage.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,12 @@ public function set_awareness_state( string $room, string $client_id, array $sta
372372
$awareness = $this->get_awareness_state( $room );
373373

374374
foreach ( $awareness as $index => $client_awareness ) {
375-
if ( $client_awareness['client_id'] === $client_id && $client_awareness['timestamp'] === $now_timestamp ) {
376-
// Cache already has the current client expiry, consider update a success (avoids cache thrashing).
375+
if (
376+
$client_awareness['client_id'] === $client_id
377+
&& $client_awareness['timestamp'] === $now_timestamp
378+
&& $client_awareness['state'] === $state
379+
) {
380+
// Cache already has the current client expiry and state, consider update a success (avoids cache thrashing).
377381
return true;
378382
}
379383

0 commit comments

Comments
 (0)