community-platform icon indicating copy to clipboard operation
community-platform copied to clipboard

refactor: server collection sync

Open chrismclarke opened this issue 2 months ago • 1 comments

PR Checklist

PR Type

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Developer experience (improves developer workflows for contributing to the project)

Description

To follow on from discussions raised in #3472:

  • Rename the db collection stream method to syncLocally and update comments to better reflect how the action uses local caching to minimise server requests
  • Update default syncLocally behavior to stop streaming from server after first response, and provide a keepAlive option that can be used to override if required
  • Update debug logging to better track start/end and total docs from sync methods
  • Tidy map pin sync method to remove previous workaround in favour of new general method
  • Tidy abstractDB interfaces to provide separate entries for DBs that support streaming vs not

Breaking (?)

  • There might be some user functionality that depends on live update streaming which is no longer supported (e.g. updated view counters or total comments), although it's hard to tell if this is the case or whether individual docs are polled for updates (hopefully will be picked up in tests). Likely too any functionality that depends on this mechanism will probably need to be refactored anyway to try and make more efficient

Git Issues

Closes #

Screenshots/Videos

Example debug logs track sync operations image


What happens next?

Thanks for the contribution! We try to make sure all PRs are reviewed ahead of our monthly maintainers call (first Monday of the month)

If the PR is working as intended it'll be merged and included in the next platform release, if not changes will be requested and re-reviewed once updated.

If you need more immediate feedback you can try reaching out on Discord in the Community Platform development channel.

chrismclarke avatar Apr 23 '24 17:04 chrismclarke

1 flaky test on run #5471 ↗︎

0 90 1 0 Flakiness 1

Details:

Merge branch 'master' into refactor/server-collection-sync
Project: onearmy-community-platform Commit: 2e9b493a48
Status: Passed Duration: 04:26 💡
Started: Apr 29, 2024 3:54 PM Ended: Apr 29, 2024 3:59 PM
Flakiness  src/integration/profile.spec.ts • 1 flaky test • ci-chrome

View Output Video

Test Artifacts
[Profile] > [By User] > [Can contact profiles by default] Test Replay Screenshots Video

Review all test suite changes for PR #3474 ↗︎

cypress[bot] avatar Apr 23 '24 17:04 cypress[bot]

The test failing remotely is fine for me locally so rerunning the CI while investigating further.

benfurber avatar Apr 29 '24 13:04 benfurber

Codecov Report

Attention: Patch coverage is 0% with 26 lines in your changes are missing coverage. Please review.

Project coverage is 66.65%. Comparing base (78e9b9d) to head (2e9b493).

Files Patch % Lines
src/stores/databaseV2/CollectionReference.ts 0.00% 20 Missing :warning:
src/stores/common/module.store.ts 0.00% 4 Missing :warning:
src/stores/Maps/maps.store.ts 0.00% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3474      +/-   ##
==========================================
- Coverage   66.67%   66.65%   -0.02%     
==========================================
  Files         427      427              
  Lines       13460    13464       +4     
  Branches     2427     2429       +2     
==========================================
  Hits         8974     8974              
- Misses       4440     4444       +4     
  Partials       46       46              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 29 '24 15:04 codecov[bot]

:tada: This PR is included in version 1.176.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

onearmy-bot avatar Apr 30 '24 13:04 onearmy-bot