aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.36k stars 2.1k forks source link

fix: Prevent creating multiple endpoint ids #13319

Closed cshfang closed 2 weeks ago

cshfang commented 2 weeks ago

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

https://github.com/aws-amplify/amplify-js/issues/13272

Description of how you validated changes

Checklist

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