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): serialize IncomingAsyncSubscriptionEventPublisher events #3489

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

lawmicha
Copy link
Contributor

@lawmicha lawmicha commented Jan 31, 2024

Issue #

#2982 (comment)

Description

Before the PR changes, the publisher would emit events concurrently which caused some of them to be missed by the subscriber even though the subscriber applied back pressure to process one event at a time (demand of max(1)). For more details regarding back-pressure, see https://developer.apple.com/documentation/combine/processing-published-elements-with-subscribers

The change, to publish the events though the same TaskQueue ensures that the events are properly buffered and sent only when the subscriber demands for it.

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.

@lawmicha lawmicha requested a review from a team as a code owner January 31, 2024 15:36
@lawmicha lawmicha force-pushed the lawmicha.sub-event-ordering3 branch from ec77dae to 1f194d2 Compare January 31, 2024 15:36
@codecov-commenter
Copy link

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (f64c471) 67.90% compared to head (1f194d2) 67.98%.
Report is 3 commits behind head on main.

Files Patch % Lines
...Sync/IncomingAsyncSubscriptionEventPublisher.swift 76.92% 3 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3489      +/-   ##
==========================================
+ Coverage   67.90%   67.98%   +0.07%     
==========================================
  Files        1080     1080              
  Lines       36406    36415       +9     
==========================================
+ Hits        24723    24755      +32     
+ Misses      11683    11660      -23     
Flag Coverage Δ
API_plugin_unit_test 67.23% <ø> (ø)
AWSPluginsCore 64.18% <ø> (ø)
Amplify 48.12% <ø> (+0.01%) ⬆️
Analytics_plugin_unit_test 81.16% <ø> (ø)
Auth_plugin_unit_test 78.98% <ø> (+0.02%) ⬆️
CoreMLPredictions_plugin_unit_test 59.44% <ø> (ø)
DataStore_plugin_unit_test 80.72% <76.92%> (+0.30%) ⬆️
Geo_plugin_unit_test 70.75% <ø> (ø)
Logging_plugin_unit_test 63.34% <ø> (ø)
Predictions_plugin_unit_test 37.16% <ø> (ø)
PushNotifications_plugin_unit_test 87.13% <ø> (ø)
Storage_plugin_unit_test 77.51% <ø> (ø)
unit_tests 67.98% <76.92%> (+0.07%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lawmicha lawmicha requested a review from thisisabhash February 2, 2024 14:06
@lawmicha lawmicha merged commit f2bc851 into main Feb 13, 2024
78 checks passed
@lawmicha lawmicha deleted the lawmicha.sub-event-ordering3 branch February 13, 2024 17:37
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