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
Add exponential backoff to the retry algorithm of WebCmdlets #19637
Conversation
Convert to Draft until #19632 will be approved by WG. |
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
…Cmdlet/Common/WebRequestPSCmdlet.Common.cs Co-authored-by: CarloToso <105941898+CarloToso@users.noreply.github.com>
…Cmdlet/Common/WebRequestPSCmdlet.Common.cs Co-authored-by: CarloToso <105941898+CarloToso@users.noreply.github.com>
4de47e4
to
a4b1b49
Compare
@mkht You could use |
We could think about using an enum for |
I was thinking that too. But I couldn't decide which was better, so I implemented it as a string. |
I think |
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment. |
This PR is marked as draft as it is still awaiting approval of the proposal by the WG. |
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment. |
@SteveL-MSFT could you reopen this PR and review it |
PR Summary
Add a new parameter
-RetryMode
toInvoke-WebRequest
andInvoke-RestMethod
to add the ability to retry with exponential backoff strategy and exponential backoff with jitter strategy.The type of
-RetryMode
is[WebRequestRetryMode]
enum and users can select one from three modes.Fixed
: Use fixed retry interval. The interval follows the value of-RetryIntervalSec
. This is the default mode.Exponential
: Use exponential backoff strategy. The retry interval is expressed asRetryIntervalSec * (2 ^ retryCount)
.ExponentialJitter
: Use exponential backoff with jitter strategy. The retry interval is expressed asRetryIntervalSec * (2 ^ retryCount) * jitter
.jitter
is a random value betweem0.0
and1.0
.Note 1:
If we select
Exponential
orExponentialJitter
, the interval will never exceed 600 seconds. This prevents the interval from becoming excessively long. 600 seconds is used bycurl
.Note 2:
This is not a breaking change, since the default mode is
Fixed
. It does not change the behavior of existing scripts.PR Context
This PR resolves #19632
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.