fix(socketio): send clientTracking.updatePosition without an ack - #409
Open
RobertoReale wants to merge 1 commit into
Open
fix(socketio): send clientTracking.updatePosition without an ack#409RobertoReale wants to merge 1 commit into
RobertoReale wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #404
Problem
updatePositionemitsclientTracking.updatePositionthrough the promisifiedemit, i.e. with an acknowledgement callback:The official web frontend emits this event without an acknowledgement — it is a notification, and the server broadcasts
clientTracking.clientUpdatedto 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 asrejected 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 thereemitis 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 broadcastsclientTracking.clientUpdatedback, and the log stays clean while typing. Tested with a single client, so the rendering of other collaborators' cursors was not exercised.