Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Middleware.php

function Middleware::retry

Middleware that retries requests based on the boolean result of invoking the provided "decider" function.

If no delay function is provided, a simple implementation of exponential backoff will be utilized.

Parameters

callable $decider Function that accepts the number of retries,: a request, [response], and [exception] and returns true if the request is to be retried.

callable $delay Function that accepts the number of retries and: returns the number of milliseconds to delay.

Return value

callable Returns a function that accepts the next handler.

File

vendor/guzzlehttp/guzzle/src/Middleware.php, line 179

Class

Middleware
Functions used to create and wrap handlers with handler middleware.

Namespace

GuzzleHttp

Code

public static function retry(callable $decider, ?callable $delay = null) : callable {
    return static function (callable $handler) use ($decider, $delay) : RetryMiddleware {
        return new RetryMiddleware($decider, $handler, $delay);
    };
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal