Skip to content

fix: Improve retry mechanisms for split pdf logic #108

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

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

jordan-homan
Copy link
Contributor

No description provided.

Copy link

@dennison33 dennison33 Sep 10, 2024

Choose a reason for hiding this comment

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

on line 213 wont this assignment fail:
(this.partitionSuccessfulResponses[operationID] as Response[])[pageIndex][pageIndex] =
response.clone();
because this.partitionSuccessfulResponses[operationID] has not been initialized to an array?

Have a look at line 192, the success responses is initialized, but the fail responses is not:
this.partitionSuccessfulResponses[operationID] = new Array(requests.length);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch! Thanks

@jordan-homan jordan-homan force-pushed the js-client-retries branch 2 times, most recently from 04c2406 to 6291cf6 Compare September 11, 2024 13:32
@jordan-homan jordan-homan marked this pull request as ready for review September 11, 2024 13:57
@awalker4
Copy link
Collaborator

awalker4 commented Sep 12, 2024

Ah, one sec, we may need to hardcode our retry values in here - let me look. EDIT - all good now.

const { baseURL } = opts;
this.client = new HTTPClientExtension();

this.client.addHook("response", (res) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe we could move this into the HTTPClientExtension class? not necessary though

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense to me!

@jordan-homan jordan-homan force-pushed the js-client-retries branch 2 times, most recently from 30260d9 to 16d75a1 Compare September 16, 2024 14:44
HTTPClient hooks.

The autogenerated code takes these values from the `x-speakeasy-retries` section of our OpenAPI
spec. However, when we call `retry` directly like this, we need to be able to pass the values
in. Once we have a reference to the SDK in the hook context, we can make requests via
`s.general.partition` and avoid duplicating logic.
@jordan-homan jordan-homan merged commit 5166f33 into main Sep 16, 2024
2 checks passed
@jordan-homan jordan-homan deleted the js-client-retries branch September 16, 2024 17:00
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