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: Prevent creating multiple endpoint ids #13319

Merged

Conversation

cshfang
Copy link
Contributor

@cshfang cshfang commented Apr 30, 2024

Description of changes

Currently, when an endpoint is created by updateEndpoint, it is not cached until a full network round trip to the service. This results in a large window during which additional updateEndpoint calls will create new endpoint ids due to none being found in the cache.

This PR adds a utility which will hold created endpoint ids in memory until it is successfully cached or if the endpoint updating has failed.

Issue #, if available

#13272

Description of how you validated changes

  • yarn test
  • Added thrown error expectation to original code and asserted the resulting behavior of the updateEndpoint function is the same (async void which throws uncaught)
  • Tested in sample app and validated that network race condition was mitigated - the updateEndpoint calls triggered by initializePushNotifications and an adjacent identifyUser call were no longer creating separate endpoints.

Checklist

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

@cshfang cshfang requested review from a team as code owners April 30, 2024 20:01
@cshfang cshfang force-pushed the fix/notifications-issues-endpoint-resolution branch from 32fcdf1 to 2f3d65d Compare April 30, 2024 22:08
ashika112
ashika112 previously approved these changes Apr 30, 2024
@cshfang cshfang merged commit 4920716 into aws-amplify:main Apr 30, 2024
30 checks passed
@cshfang cshfang deleted the fix/notifications-issues-endpoint-resolution branch April 30, 2024 23:22
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.

None yet

3 participants