Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve step queue during reconnect #5126

Merged
merged 5 commits into from
Dec 18, 2023

Conversation

max-nextcloud
Copy link
Collaborator

@max-nextcloud max-nextcloud commented Dec 11, 2023

📝 Summary

During a network disconnect
Yjs-websocket notices missing awareness messages and closes the connection.
In this case the remaining steps can also not be send out and the request fails.
Preserve the queue so we can use it once the network is back up.

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation is not required

@max-nextcloud max-nextcloud force-pushed the fix/preserve-step-queue-during-reconnect branch from 830c0d4 to 2db66d5 Compare December 11, 2023 14:15
@max-nextcloud max-nextcloud force-pushed the fix/preserve-step-queue-during-reconnect branch from 2db66d5 to caec8f0 Compare December 11, 2023 19:12
Copy link
Member

@mejo- mejo- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

src/services/WebSocketPolyfill.js Outdated Show resolved Hide resolved
src/services/WebSocketPolyfill.js Outdated Show resolved Hide resolved
@juliusknorr juliusknorr added bug Something isn't working 2. developing labels Dec 15, 2023
@max-nextcloud max-nextcloud force-pushed the fix/preserve-step-queue-during-reconnect branch from caec8f0 to 111c5d1 Compare December 15, 2023 20:20
During a network disconnect
Yjs-websocket notices missing awareness messages and closes the connection.
In this case the remaining steps can also not be send out and the request fails.
Preserve the queue so we can use it once the network is back up.

Signed-off-by: Max <[email protected]>
When yjs does not receive awareness updates
it will close and reopen the websocket.
Keep the content of the queue, i.e. the outgoing steps
so they can be send out once the connection is back.

Signed-off-by: Max <[email protected]>
Change the content of `queue` with `queue.splice`
rather than setting `queue` to another array.

Signed-off-by: Max <[email protected]>
Also add a unit test for the websocket polyfill

Signed-off-by: Max <[email protected]>
@max-nextcloud max-nextcloud force-pushed the fix/preserve-step-queue-during-reconnect branch from 111c5d1 to 1911a14 Compare December 18, 2023 14:27
avoids the old provider leaking error events.

Signed-off-by: Max <[email protected]>
Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works

@max-nextcloud
Copy link
Collaborator Author

/backport to stable28

@max-nextcloud max-nextcloud merged commit 098cbc2 into main Dec 18, 2023
36 checks passed
@max-nextcloud max-nextcloud deleted the fix/preserve-step-queue-during-reconnect branch December 18, 2023 14:54
@max-nextcloud
Copy link
Collaborator Author

/backport to stable27

@max-nextcloud
Copy link
Collaborator Author

/backport to stable26

@backportbot-nextcloud
Copy link

The backport to stable26 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable26
git pull origin stable26

# Create the new backport branch
git checkout -b fix/foo-stable26

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable26

Error: Unknown error

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@backportbot-nextcloud
Copy link

The backport to stable27 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable27
git pull origin stable27

# Create the new backport branch
git checkout -b fix/foo-stable27

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable27

Error: Unknown error

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants