Gcloud::Backoff

Backoff allows users to control how Google API calls are retried. If an API call fails the response will be checked to see if the call can be retried. If the response matches the criteria, then it will be retried with an incremental backoff. This means that an increasing delay will be added between each retried call. The first retry will be delayed one second, the second retry will be delayed two seconds, and so on.

require "gcloud/backoff"

Gcloud::Backoff.retries = 5 # Set a maximum of five retries per call

Methods

Attributes

http_codes [RW]

The HTTP Status Codes that should be retried.

The default values are 500 and 503.

reasons [RW]

The Google API error reasons that should be retried.

The default values are rateLimitExceeded and userRateLimitExceeded.

retries [RW]

The number of times a retriable API call should be retried.

The default value is 3.