feat(gapic-common): Add retry options and expanded retry logic #672
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
The google-cloud-pubsub library is required to support the following RPC retry policy, provided by the Pub/Sub team:
This configuration is similar to the old google/cloud/pubsub/v1/publisher_client_config.json that was used prior to the introduction of this generator and gapic-common, except that in the table above "init RPC timeout" is
5s
and in the older configinitial_rpc_timeout_millis
was60000
(60s).We need a solution that accepts values for "init RPC timeout", "max RPC timeout", "rpc timeout multiplier" and "total timeout", and uses them as suggested by their names to perform incrementally longer retries limited by a max timeout and with a check for a total time deadline. These properties must be configurable per RPC and for convenience should also be configurable as a default for the client, although that may be outside the scope of gapic-common.
I do not believe this behavior can be supported by the current retry logic in gapic-common. The
options
param only containstimeout
, and the logic callscalculate_deadline
just once before beginning the retry block, and the value is never recalculated.The value of
timeout
used to computedeadline
is currently obtained from pubsub_grpc_service_config.json and is60
.It is actually not clear how the
options
paramtimeout
(obtained from the service configtimeout
) should be mapped to the configuration above. The service config description for the property states that it is:Which seems ambiguous in the context of using "rpc timeout multiplier" (above) to compute an incrementally larger timeout for each RPC retry. Taken literally, the "default timeout" should probably be "init RPC timeout", because without retries, that's the timeout that would be used for the first (and only) call. (Per @dazuma, offline.)
See nodejs-pubsub/src/v1/publisher_client_config.json and gax-nodejs/src/normalCalls/retries.ts for how this is done in nodejs-pubsub.
The text was updated successfully, but these errors were encountered: