Skip to content

WebCmdlets should support retry #5582

Closed

Description

suggested design
Invoke-WebRequest ... -RetryCount <int> -RetryIntervalSec <int>

Activity

  1. markekraus commented on Nov 29, 2017

    @markekraus
    Contributor

    This one was on my personal wish list!

  2. ffeldhaus commented on Apr 6, 2018

    @ffeldhaus
    Contributor

    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:

    • Parameter -Retry could indicate that the WebCmdlet should retry the request with a default, conservative, retry strategy
    • Parameter -RetryCount could indicate how many retries should be made
    • Parameter -RetryIntervalSec could indicate the interval between different request
    • Parameter -RetryBackofStrategy could indicate if linear or exponential backof strategy should be used
    • Parameter -RetryStatusCodes could contain a list of Status Codes for which the request is retried
    • Parameters could also be set on WebSession in PrepareSession() and then have this area of code retrieve the values from WebSession. It would mean extending WebRequestSession to include new Properties

    In 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.

  3. markekraus commented on Apr 7, 2018

    @markekraus
    Contributor

    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 Aditya Patwardhan (@adityapatwardhan) Steve Lee (@SteveL-MSFT)

  4. SteveL-MSFT commented on Apr 9, 2018

    @SteveL-MSFT
    Member

    I'll just add a couple of thoughts:

    1. it seems that there's enough discussion to warrant a RFC
    2. by default, we should borrow from curl making the assumption they've already spent time going through design discussion unless there's something that we can improve upon
    3. there doesn't need to be a single PR to address all the requests, we can do them in stages as long as subsequent PRs build upon previous PRs and don't introduce confusion or compatibility breaks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.WG-Cmdletsgeneral cmdlet issues

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions