Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Allow retry and timeout settings on the publisher client #222

Description

@anguillanneuf

Allow retry and timeout settings on the Publisher.

timeout= should take google.api_core.timeout.ExponentialTimeout and google.api_core.timeout.ConstantTimeout (also LogicalTimeout in future work).

The goal is be able to set custom retry and custom timeout on the PublisherClient, like this:

custom_retry=api_core.retry.Retry(
initial=0.250, # seconds (default: 0.1)maximum=90.0, # seconds (default: 60.0)multiplier=1.45, # default: 1.3deadline=300.0, # seconds (default: 60.0)predicate=api_core.retry.if_exception_type(
api_core.exceptions.Aborted,
api_core.exceptions.DeadlineExceeded,
api_core.exceptions.InternalServerError,
api_core.exceptions.ResourceExhausted,
api_core.exceptions.ServiceUnavailable,
api_core.exceptions.Unknown,
api_core.exceptions.Cancelled,
),
)
custom_timeout=api_core.timeout.ExponentialTimeout(
initial=1.0, maximum=10.0, multiplier=1.0, deadline=300.0, )
# Something like this:publisher=pubsub_v1.PublisherClient(
publisher_options=pubsub_v1.types.PublisherOptions(
retry=custom_retry,
timeout=custom_timeout,
),
)

Here are the defaults and how they are set currently: https://github.com/googleapis/googleapis/blob/3a935fab757e09c72afd4aa121147a4c97dccc3e/google/pubsub/v1/pubsub_grpc_service_config.json#L42-L62

Remember to update UPGRADING.md as well.

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the googleapis/python-pubsub API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions