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(datastore): observequery local only collect #3214

Merged
merged 3 commits into from
Dec 11, 2023

Conversation

atierian
Copy link
Member

@atierian atierian commented Sep 8, 2023

Issue #

Description

DataStore.observeQuery(...) has some internal logic to batch snapshots received based on total count or time elapsed while syncing. This logic is applied when DataStore thinks it is hasn't yet completed syncing.

When DataStore is in local only mode (i.e. when AWSAPIPlugin isn't being used), it is never "completed syncing", leading to the same throttling logic.

This change ensures that the throttling / collect logic is not applied when DataStore is in local only mode.

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@atierian atierian requested a review from a team as a code owner September 8, 2023 21:59
@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2023

Codecov Report

Merging #3214 (0c60997) into main (659fdf9) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main    #3214      +/-   ##
==========================================
+ Coverage   64.74%   64.76%   +0.02%     
==========================================
  Files        1090     1090              
  Lines       36988    36998      +10     
==========================================
+ Hits        23948    23962      +14     
+ Misses      13040    13036       -4     
Flag Coverage Δ
API_plugin_unit_test 66.52% <ø> (ø)
AWSPluginsCore 69.55% <ø> (ø)
Amplify 47.84% <ø> (-0.02%) ⬇️
Analytics_plugin_unit_test 86.39% <ø> (ø)
Auth_plugin_unit_test 75.23% <ø> (+0.07%) ⬆️
CoreMLPredictions_plugin_unit_test 59.44% <ø> (ø)
DataStore_plugin_unit_test 81.14% <100.00%> (-0.02%) ⬇️
Geo_plugin_unit_test 54.06% <ø> (ø)
Logging_plugin_unit_test 62.77% <ø> (ø)
Predictions_plugin_unit_test 35.17% <ø> (ø)
PushNotifications_plugin_unit_test 69.69% <ø> (ø)
Storage_plugin_unit_test 54.10% <ø> (ø)
unit_tests 64.76% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...Plugin/Storage/StorageEngine+SyncRequirement.swift 80.18% <100.00%> (+0.38%) ⬆️
...gin/Subscribe/DataStoreObserveQueryOperation.swift 83.17% <100.00%> (+0.65%) ⬆️

... and 10 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:00 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:00 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:00 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:00 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:00 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:00 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:00 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:01 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:01 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:01 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:01 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:01 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 8, 2023 22:01 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to Fortify September 8, 2023 23:00 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 13:02 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 13:03 — with GitHub Actions Inactive
sebaland
sebaland previously approved these changes Sep 12, 2023
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
.byTimeOrCount(
self.serialQueue,
self.itemsChangedPeriodicPublishTimeInSeconds,
self.shouldBatchDuringSync ? self.itemsChangedMaxSize : 1
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps we can open up an issue on the other DataStore repos to let them verify if they have the same behavior, and if so they can do the similar change here

@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian temporarily deployed to IntegrationTest September 12, 2023 14:08 — with GitHub Actions Inactive
@atierian atierian merged commit 1994e14 into main Dec 11, 2023
64 of 65 checks passed
@atierian atierian deleted the datastore-observequery-local branch December 11, 2023 14:05
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.

4 participants