-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[core-http] Throttling retry policy fix in core-http #15832
Conversation
…to harshan/core-http/throttling-policy
@@ -91,6 +91,7 @@ | |||
"@azure/core-http": "^1.2.0", | |||
"@azure/core-paging": "^1.1.1", | |||
"@azure/core-tracing": "1.0.0-preview.11", | |||
"@azure/core-util": "^1.0.0-beta.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is appconfiguration in beta? if not, it should not take a dep on a beta.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
App-config is beta, but we may soon GA in the next couple of months.
Why is core-util in beta anyways? Can't we make that GA instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we did not settle on the public surface for it yet.
appconfig is in beta but core-http and core-amqp are not IIRC and you added core-util as a dep there. My recommendation is to keep the local implementation of delay for now and have it moved to core-util in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't want to keep 3 copies of delay (core-http, core-amqp and app-config).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't want to keep 3 copies of delay (core-http, core-amqp and app-config).
Why cannot App Config use the one in core-http?
Since this PR's main objective is around fixing an issue with the retry policy, can we stick to just that in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramya-rao-a So, you're suggesting core-http and core-amqp would have delay? Can do that if weare fine with 2 copies.
(What's the point of core-util then?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of core-util then
It is pending the on the conclusion on the discussion we had today on the subject of code sharing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have two copies of (advanced) delay.. core-amqp and core-http.
Logged #15930 for core-util discussion.
… harshan/core-http/throttling-policy
@@ -12,7 +12,7 @@ import { | |||
Constants, | |||
RestError | |||
} from "@azure/core-http"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we just need to move to corev2 so we can fix #6484
@@ -181,7 +181,7 @@ export class DefaultHttpClient extends FetchHttpClient { | |||
} | |||
|
|||
// @public | |||
export function delay<T>(t: number, value?: T): Promise<T | void>; | |||
export function delay<T>(delayInMs: number, abortSignal?: AbortSignalLike, abortErrorMsg?: string, value?: T): Promise<T | void>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value?: T
should be the 2nd argument, otherwise this would be a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
I'll switch to that.
What about the core-amqp counterpart? How to get the copy of this method to stay consistent? Does that mean we can only bring consistency if we upgrade to a major version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HarshaNalluru I think there is no need to care about their consistency, we can just ignore them once core-util
goes GA. Also, core-http
is going to be phased out fairly soon anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! A few small comments/suggestions
} | ||
}; | ||
|
||
onAborted = (): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this assigned? I don't see it getting assigned back to undefined
can we just declare the method in scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copied this from core-amqp.
Can be done, will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @HarshaNalluru! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Microsoft.ApiManagement : Release api-version 2021-04-01-preview (Azure#15832) * Adds base for updating Microsoft.ApiManagement from version preview/2021-01-01-preview to version 2021-04-01-preview * Updates readme * Updates API version in new specs and examples * Added support for GraphQL API type (Azure#14851) * Added support for GraphQL API type * Added missing enum value for GraphQL APIs. * add schema definition fix from 2021-01-01-preview (Azure#14883) Co-authored-by: Alan Feng <alanfeng@microsoft.com> * Vanguard: Get Outbound Network Dependency (Azure#14900) * outbound dependency * fix resource * Update backup/restore API for managed identities (Azure#14973) * Update backup/restore API for system-assigned and user-assigned identities * Fix formatting issue * Rename user-assigned-msi-client-id with client-id * SystemData implemenation on API Management Control Plane (Azure#14899) * system-data * fix spec * remove unreferenced file * APIM - Network Watcher Connectivity Check integration specs (Azure#15056) * Connectivity Check API Specs * Fix * Fix errors * style fixs * Fix 202 code * HTTPConnect request parameters * Fix errors Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Parameter examples added (Azure#14836) * platformversion (Azure#15114) * fix update service (Azure#15478) * HttpConnect example (Azure#15493) * HttpConnect example * Prettifier fix Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Added properties of difference API spec format for "SchemaDocumentProperties" (Azure#15703) * add schema definition fix from 2021-01-01-preview * added properties for SchemaDocumentProperties * updated the fix * updated fix * [APIM]Add private endpoint connection APIs (Azure#15115) * Add private endpoint connection apis * add readme * quick fixes * fix to PE contract * Small fixes * small fixes * small fixes * Small fixes * small fixes * small fix * small fixes * small fixes * small fixes * Update readme.md * fix error * small fix * fix format * address comments * small fixes * Change to lower case * small fixes Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * Adds base for updating Microsoft.ApiManagement from version preview/2021-01-01-preview to version 2021-04-01-preview * Updates readme * Updates API version in new specs and examples * Added support for GraphQL API type (Azure#14851) * Added support for GraphQL API type * Added missing enum value for GraphQL APIs. * add schema definition fix from 2021-01-01-preview (Azure#14883) Co-authored-by: Alan Feng <alanfeng@microsoft.com> * Vanguard: Get Outbound Network Dependency (Azure#14900) * outbound dependency * fix resource * Update backup/restore API for managed identities (Azure#14973) * Update backup/restore API for system-assigned and user-assigned identities * Fix formatting issue * Rename user-assigned-msi-client-id with client-id * SystemData implemenation on API Management Control Plane (Azure#14899) * system-data * fix spec * remove unreferenced file * APIM - Network Watcher Connectivity Check integration specs (Azure#15056) * Connectivity Check API Specs * Fix * Fix errors * style fixs * Fix 202 code * HTTPConnect request parameters * Fix errors Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Parameter examples added (Azure#14836) * platformversion (Azure#15114) * fix update service (Azure#15478) * HttpConnect example (Azure#15493) * HttpConnect example * Prettifier fix Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> * Added properties of difference API spec format for "SchemaDocumentProperties" (Azure#15703) * add schema definition fix from 2021-01-01-preview * added properties for SchemaDocumentProperties * updated the fix * updated fix * [APIM]Add private endpoint connection APIs (Azure#15115) * Add private endpoint connection apis * add readme * quick fixes * fix to PE contract * Small fixes * small fixes * small fixes * Small fixes * small fixes * small fix * small fixes * small fixes * small fixes * Update readme.md * fix error * small fix * fix format * address comments * small fixes * Change to lower case * small fixes Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> * fix tenant sync contract * fix linter issues * examples for managed identity backup * prettier * Fix Apis-Get and updated comments for api-version 2021-04-01-preview (#3) * add schema definition fix from 2021-01-01-preview * added fix * small fix (#6) * 'examples' added to RepresentationContract (#7) Co-authored-by: Alexander Zaslonov <zaslonov.alexander@gmail.com> Co-authored-by: DreamlessA <DreamlessA@users.noreply.github.com> Co-authored-by: Alan Feng <alanfeng@microsoft.com> Co-authored-by: Jatin Sanghvi <20547963+JatinSanghvi@users.noreply.github.com> Co-authored-by: Nicolás Barrera <nicolasbarrera@outlook.com> Co-authored-by: Nicolás Barrera <t-nbarrera@microsoft.com> Co-authored-by: VitaliyKurokhtin <vitaliik@microsoft.com> Co-authored-by: RupengLiu <rliu1211@terpmail.umd.edu> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: RupengLiu <rupliu@microsoft.com> Co-authored-by: VitaliyKurokhtin <Vitaliy.Kurokhtin@gmail.com>
…3019) ### Packages impacted by this PR core-util ### Issues associated with this PR #15930 ### Describe the problem that is addressed by this PR - Update "delay" in core-util to support abort message - Unduplicate "delay" function in core-http and core-amqp ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? - Choose the implementation with "options" parameters to keep the flexibility in case we want to add extra functionality in the future ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ #15832 ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [x ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
Fixes #15796
Problem
The throttlingRetryPolicy in core-http has the potential to retry for an extended period if the service continues returning "retry after" headers on subsequent calls.
Here's the snippet of code that handles the "retry after" retries:
Solution
Update delay such that it respects abort signal.
Similar to what I had to do for app-config at #15721