You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep an Agent's per-channel presence state in one place #765
latestDocVersionStreams and latestDocVersions, for doc presence
The "client left, so send p: null" rule runs in three places:
_retractPresences
_broadcastPresence, for presence still in flight
_cleanup
Each presence fix so far has added or reshaped one of these maps, and had to get that map's teardown right separately. For example, #751 had to stop leaving an empty presenceRequests map behind for rejected presence, and #764 is another leftover-entry case. Some state is never cleaned up at all: presenceSubscriptionSeq keeps an entry for every channel the client has ever subscribed to or unsubscribed from.
Suggested fix
Keep per-channel presence state in one object per channel, holding the stream, the subscription seq, and the stored and in-flight requests. Give that object one teardown, create it on first use, and delete it once it's empty.
This should also fix #764: when a presence leaves, drop its stored request rather than keeping a p: null entry, unless a broadcast for the same id is still in flight. Keep it until that broadcast finishes, so #763 can still tell from its pv that a late presence is stale.
Activity
Agent.presenceRequestskeeps ap: nullentry for every presence that has left #764 as a duplicate of this issue