Construct a polling policy from existing Retry and Backoff policies.
A polling policy can be built by composing a retry and backoff policy. For example, to create a polling policy that "retries N times, waiting a fixed
period between retries" you could compose the "try N times" retry policy with the "wait a fixed period between retries" backoff policy.
This class makes it easier to create such composed polling policies.
Constructors
GenericPollingPolicy(Retry, Backoff)
Parameters
Name
Description
retry_policy
Retry
backoff_policy
Backoff
Functions
virtual clone() const
Return a copy of the current policy.
This function is called at the beginning of the polling loop. Policies that are based on relative time should restart their timers when this function is called.
Returns
Type
Description
std::unique_ptr< PollingPolicy >
virtual OnFailure(Status const &)
A callback to indicate that a polling attempt failed.
This is called when a polling request fails. Note that this callback is not invoked when the polling request succeeds with "operation not done".
Parameter
Name
Description
status
Status const &
Returns
Type
Description
bool
true if the failure should be treated as transient and the polling loop should continue.
virtual WaitPeriod()
How long should the polling loop wait before trying again.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["\u003cp\u003eThe webpage provides documentation for the \u003ccode\u003eGenericPollingPolicy\u003c/code\u003e class in the Google Cloud C++ client library, detailing its functionality and usage across various versions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGenericPollingPolicy\u003c/code\u003e class allows for the construction of polling policies by combining retry and backoff policies, providing flexibility in managing how operations are retried.\u003c/p\u003e\n"],["\u003cp\u003eKey features of the \u003ccode\u003eGenericPollingPolicy\u003c/code\u003e include a \u003ccode\u003eclone()\u003c/code\u003e function for creating copies of the policy, an \u003ccode\u003eOnFailure()\u003c/code\u003e callback for handling failed polling attempts, and a \u003ccode\u003eWaitPeriod()\u003c/code\u003e function for defining the wait time between retries.\u003c/p\u003e\n"],["\u003cp\u003eThe documentation provides parameter details for the \u003ccode\u003eGenericPollingPolicy\u003c/code\u003e constructor, which takes a \u003ccode\u003eRetry\u003c/code\u003e policy and a \u003ccode\u003eBackoff\u003c/code\u003e policy, as well as the return type and description of the policy.\u003c/p\u003e\n"]]],[],null,[]]