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

Fix sync errors after network issues #4474

Merged
merged 12 commits into from
Jul 11, 2023
Merged

Fix sync errors after network issues #4474

merged 12 commits into from
Jul 11, 2023

Conversation

mejo-
Copy link
Member

@mejo- mejo- commented Jul 10, 2023

📝 Summary

🚧 TODO

  • Look into Cypress test
  • Remove .only from Cypress test
  • remove disableBc: true from SyncServiceProvider.js

🏁 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

@mejo- mejo- added this to the Nextcloud 28 milestone Jul 10, 2023
@mejo- mejo- requested a review from juliusknorr July 10, 2023 16:00
@cypress
Copy link

cypress bot commented Jul 10, 2023

1 failed and 1 flaky tests on run #10957 ↗︎

1 147 2 0 Flakiness 1

Details:

Fix sync errors after network issues
Project: Text Commit: ce2b903fac
Status: Failed Duration: 03:34 💡
Started: Jul 11, 2023 5:03 PM Ended: Jul 11, 2023 5:07 PM
Failed  cypress/e2e/sync.spec.js • 1 failed test

View Output Video

Test Artifacts
Sync > recovers from a lost connection Output Screenshots
Flakiness  cypress/e2e/directediting.spec.js • 1 flaky test

View Output Video

Test Artifacts
direct editing > Open an existing plain text file, edit it Output Screenshots

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@mejo- mejo- force-pushed the test/sync-protocol branch from 0226261 to fc8b297 Compare July 11, 2023 06:44
@max-nextcloud
Copy link
Collaborator

I could not reproduce the cypress failure locally... set a crazy long wait time ™️ for the failed cypress statement to see if it's a matter of speed.

@mejo- mejo- force-pushed the test/sync-protocol branch 2 times, most recently from 2a49ed9 to 21f6f39 Compare July 11, 2023 11:35
@max-nextcloud
Copy link
Collaborator

Ahh... now the SyncServiceProvider.spec is failing because the browser broadcast kicks in.

@mejo- mejo- force-pushed the test/sync-protocol branch 3 times, most recently from 1cda958 to 61524c2 Compare July 11, 2023 13:34
@mejo- mejo- marked this pull request as ready for review July 11, 2023 13:42
@juliusknorr
Copy link
Member

Code looks good to me, also did a couple of tests using separate browsers and killing random connections, setting offline/online again, so far no obstacles found :) Very nice.

@juliusknorr
Copy link
Member

One minor unrelated UI bug, the notice about connection issues seems to no longer be sticky, but unrelated to this change:

Screenshot 2023-07-11 at 16 48 05

@mejo-
Copy link
Member Author

mejo- commented Jul 11, 2023

/compile

@mejo-
Copy link
Member Author

mejo- commented Jul 11, 2023

One minor unrelated UI bug, the notice about connection issues seems to no longer be sticky, but unrelated to this change:

Interesting, good catch. Let's open a new issue to track it: #4483

@mejo- mejo- force-pushed the test/sync-protocol branch from 61524c2 to 92c86de Compare July 11, 2023 15:04
max-nextcloud and others added 5 commits July 11, 2023 19:01
Also drop the `sending` logic from `WebsocketPolyfill`.
It prevented resending the queue after an error.
The queue was non empty then so `this.#initiateSending()` was not called.

`SyncService` is responsible for throttling the network requests if needed.

Signed-off-by: Max <[email protected]>
max-nextcloud and others added 7 commits July 11, 2023 19:01
This way the calling function can catch all network errors
and make sure to preserve the unsent steps in the queue.

Signed-off-by: Max <[email protected]>
SyncService will resend failed steps after network has recovered.

Remove obsolete `data.retry` flag when emitting error of
`ERROR_TYPE.CONNECTION_FAILED`.

Fixes: #4340

Signed-off-by: Jonas <[email protected]>
Also only wait for `@alive` once in `syncs even when initial state was
present` to fix the test.

Signed-off-by: Jonas <[email protected]>
This is required for Cypress tests where we want the broadcast channel
synchronization to be disabled.

If not passed, default to `true` in debug mode and `false` otherwise.

Signed-off-by: Jonas <[email protected]>
Signed-off-by: nextcloud-command <[email protected]>
@mejo- mejo- force-pushed the test/sync-protocol branch from efe68c0 to ce2b903 Compare July 11, 2023 17:01
@mejo- mejo- merged commit c81b0cd into main Jul 11, 2023
@delete-merged-branch delete-merged-branch bot deleted the test/sync-protocol branch July 11, 2023 17:08
@mejo-
Copy link
Member Author

mejo- commented Jul 11, 2023

/backport 6454257,c012aac34c0a47f9b3fae67878a5244a9ac12638,2a666d1ea5958abb26f99cc39cd9372f5c802bc5,6a4489e8cce0d73bcee115fe472738cef180270a,155bbb5fa5783ef08e3ac8a6d3106c236d5c606e,0329f46f61420d5d4fbcf1c7da02d3cb71712161,58fc762c4da53ec6275513c447275b835371b67b,fa5d293a2df74b4a6189c3c4cd9f3bed41d47981,d196ae0d1fd16eb2a5ba2c08e400c92e4c7adb0f,f0396923a4ed15ec104d7e9533ac3a053cea725b,236b07ef71353083d2bafaac86bbe81973d3116e to stable27

@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

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

@mejo-
Copy link
Member Author

mejo- commented Jul 11, 2023

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.

Lost content in collaborative session Issues when reconnecting
4 participants