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(endpoints): resolve service-specific endpoint once per client #1382

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Aug 29, 2024

aws/aws-sdk-js-v3#6423

  • resolve service specific endpoint once per config (client instance)
  • this avoids the ENV and file system read from loadConfig

@kuhe kuhe requested review from a team as code owners August 29, 2024 16:49
@kuhe kuhe requested a review from milesziemer August 29, 2024 16:49
@kuhe kuhe force-pushed the feat/endpoints branch 6 times, most recently from 28f42dd to 71b17e3 Compare August 29, 2024 18:43
@@ -39,9 +39,19 @@ export const getEndpointFromInstructions = async <
context?: HandlerExecutionContext
): Promise<EndpointV2> => {
if (!clientConfig.endpoint) {
const endpointFromConfig = await getEndpointFromConfig(clientConfig.serviceId || "");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the issue was that this call involved a call to loadConfig for every request, which calls memoize rather than calling a memoized function, leading to repeated calls to fs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this delayed every request by around 50ms in my testing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

edit: "slurpFile" has a cache, but it is several functions/modules deep in terms of unnecessary calls

@kuhe kuhe merged commit c8c53ae into smithy-lang:main Sep 3, 2024
11 checks passed
@kuhe kuhe deleted the feat/endpoints branch September 3, 2024 15:34
This pull request was closed.
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.

3 participants