Skip to content

fix(socketio): send clientTracking.updatePosition without an ack - #409

Open
RobertoReale wants to merge 1 commit into
overleaf-workshop:masterfrom
RobertoReale:fix/update-position-fire-and-forget
Open

fix(socketio): send clientTracking.updatePosition without an ack#409
RobertoReale wants to merge 1 commit into
overleaf-workshop:masterfrom
RobertoReale:fix/update-position-fire-and-forget

Conversation

@RobertoReale

Copy link
Copy Markdown

Fixes #404

Problem

updatePosition emits clientTracking.updatePosition through the promisified emit, i.e. with an acknowledgement callback:

return this.emit('clientTracking.updatePosition', {row, column, doc_id})
    .then(() => { return; });

The official web frontend emits this event without an acknowledgement — it is a notification, and the server broadcasts clientTracking.clientUpdated to the other clients. Asking for an ack turns every cursor movement into a promise that can only fail, and the only caller (ClientManager) attaches no .catch, so each failure is logged twice: as a 5 s timeout and as rejected promise not handled within 1 second. While typing this happens several times per second.

Change

Emit the event directly on the socket, with no acknowledgement callback. The Alt (HTTP) scheme keeps the previous path, since there emit is implemented as a request/response cycle and the promise is how the call completes.

Verification

Against overleaf.com with 0.15.10 + this patch: cursor movements go out as 5:::{"name":"clientTracking.updatePosition",…} (no ack id), the server still processes them and broadcasts clientTracking.clientUpdated back, and the log stays clean while typing. Tested with a single client, so the rendering of other collaborators' cursors was not exercised.

The official web frontend emits this event without an acknowledgement
callback. Requesting one turns every cursor movement into a promise that can
only fail: `ClientManager` calls `updatePosition` without a `.catch`, so a
slow or missing acknowledgement produces both a 5s timeout and an unhandled
promise rejection, several times per second while typing.

The `Alt` (HTTP polling) scheme keeps the previous path, since there the emit
is implemented over a request/response cycle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clientTracking.updatePosition waits for an acknowledgement: 5s timeouts and unhandled rejections on every cursor move

1 participant