Skip to content

A room's version can restart at 1 after an hour of steady presence #891

Closed as not planned

Description

@huzaifaalmesbah

The _version row expires one hour after its last bump, but a write that only refreshes a timestamp doesn't bump it, so a room whose people stay for more than an hour loses its _version row to cleanup, and the next change starts the counter again at 1, which a reader that last saw 1 takes as no change.

Checked on main (ce76757), without an external object cache:

Step wp_get_presence_room_versions()
Client a joins '1'
a keeps refreshing; _version passes its expiry, which the refreshes don't push back '1'
wp_delete_expired_presence_data() runs null
Client b joins '1'

The comment in wp_presence_bump_room_version() says the row "outlives every row in the room", which holds for a room that changes but not for one that stays still. With an external object cache, evicting version:{room} restarts the counter the same way.

Tasks

  • Keep a room's version from repeating a value it has already handed out, whether by extending _version on refresh or by giving the counter a part that changes when it's recreated
  • Test: a version read before the _version row is cleaned up differs from the one read after the next arrival

Activity

  1. huzaifaalmesbah commented on Oct 23, 2026

    @huzaifaalmesbah
    MemberAuthor

    Not a bug in practice: once cleanup removes _version the version reads null until the next arrival, and the only reader, gutenberg-sync-engines' SSE stream, polls every 0.5s, so it sees 1 → null as a change and rereads the room; missing an arrival would need the cleanup and that arrival inside the same half second.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions