• QWebDownload
  • WebRetryPolicy
  • WebRetryPolicy Class

    Configurable retry policy with multiple backoff strategies. More...

    Header: #include <WebRetryPolicy>

    Public Functions

    int calculateDelay(int attemptNumber) const
    bool isRetryable(QNetworkReply::NetworkError error) const
    int maxRetries() const
    void setRetryOnConnectionRefused(bool retry)
    void setRetryOnDnsFailure(bool retry)
    void setRetryOnTimeout(bool retry)
    bool shouldRetry(int currentAttempt) const

    Detailed Description

    WebRetryPolicy defines how QWebDownload retries failed requests. It supports four backoff strategies (Linear, Exponential, Fibonacci, Fixed) and provides factory methods for common use cases.

    Predefined policies

    // Critical downloads: 5 retries, fibonacci backoff
    config.retryPolicy = WebRetryPolicy::forCritical();
    
    // Feed updates: 3 retries, exponential backoff
    config.retryPolicy = WebRetryPolicy::forFeedUpdate();
    
    // Non-critical: 2 retries, linear backoff
    config.retryPolicy = WebRetryPolicy::forFavicon();
    
    // No retries at all
    config.retryPolicy = WebRetryPolicy::noRetry();

    See also QWebDownload and WebDownloadConfig.

    Member Function Documentation

    int WebRetryPolicy::calculateDelay(int attemptNumber) const

    Returns retry delay.

    bool WebRetryPolicy::isRetryable(QNetworkReply::NetworkError error) const

    Whether or not we should try, try again.

    int WebRetryPolicy::maxRetries() const

    Returns max retries.

    void WebRetryPolicy::setRetryOnConnectionRefused(bool retry)

    Sets if we will retry on connection refused.

    void WebRetryPolicy::setRetryOnDnsFailure(bool retry)

    Sets if we will retry on DNS errors.

    void WebRetryPolicy::setRetryOnTimeout(bool retry)

    Sets if we will retry on timeout errors.

    bool WebRetryPolicy::shouldRetry(int currentAttempt) const

    Check if retries should continue or give up.