suggested design
Invoke-WebRequest ... -RetryCount <int> -RetryIntervalSec <int>
This one was on my personal wish list!
As there is already a pull request #5760 for this issue, I'd like to add my thoughts with regards to this new feature.
Many Web Services recommend that clients should implement a retry strategy to cope with intermittent failures of a web service, but also not to overload the service with too many subsequent requests (e.g. use Exponential Backof). But there are also other use cases for retries, where a client wants to regularly check if a Website comes online (retry until Status Code not 404), if a resource was modified (retry until Status Code not 304). Some responses may indicate, that the request rate should be reduced (e.g. AWS uses Status Code 503 "Slow Down"), which should be considered by a retry strategy.
In my opinion, PowerShell should allow to configure different strategies for retries. The following are some of my thoughts and points taken from the discussion in PR #5760:
-Retry could indicate that the WebCmdlet should retry the request with a default, conservative, retry strategy-RetryCount could indicate how many retries should be made-RetryIntervalSec could indicate the interval between different request-RetryBackofStrategy could indicate if linear or exponential backof strategy should be used-RetryStatusCodes could contain a list of Status Codes for which the request is retriedIn my opinion this is such an important feature, that it requires more discussion and an agreement on how it should be implemented, before work is continued on the PR.
I agree that we should consider the design more thoroughly before work continues in the PR. At present, users can roll their own retry and backoff strategies, so it is not urgent that we include this feature. However, including the wrong feature may make us a bad citizen and promote poor behavior. I definitely don't want that.
/cc @adityapatwardhan @SteveL-MSFT
I'll just add a couple of thoughts:
curl making the assumption they've already spent time going through design discussion unless there's something that we can improve upon
Most helpful comment
As there is already a pull request #5760 for this issue, I'd like to add my thoughts with regards to this new feature.
Many Web Services recommend that clients should implement a retry strategy to cope with intermittent failures of a web service, but also not to overload the service with too many subsequent requests (e.g. use Exponential Backof). But there are also other use cases for retries, where a client wants to regularly check if a Website comes online (retry until Status Code not 404), if a resource was modified (retry until Status Code not 304). Some responses may indicate, that the request rate should be reduced (e.g. AWS uses Status Code 503 "Slow Down"), which should be considered by a retry strategy.
In my opinion, PowerShell should allow to configure different strategies for retries. The following are some of my thoughts and points taken from the discussion in PR #5760:
-Retrycould indicate that the WebCmdlet should retry the request with a default, conservative, retry strategy-RetryCountcould indicate how many retries should be made-RetryIntervalSeccould indicate the interval between different request-RetryBackofStrategycould indicate iflinearorexponentialbackof strategy should be used-RetryStatusCodescould contain a list of Status Codes for which the request is retriedIn my opinion this is such an important feature, that it requires more discussion and an agreement on how it should be implemented, before work is continued on the PR.