Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support customizable retry and timeout settings on the publisher client #299

Merged
merged 19 commits into from Jun 15, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions google/cloud/pubsub_v1/types.py
Expand Up @@ -18,10 +18,12 @@
import enum
import inspect
import sys
from typing import Union

import proto

from google.api import http_pb2
import google.api_core
from google.api_core import gapic_v1
from google.iam.v1 import iam_policy_pb2
from google.iam.v1 import policy_pb2
Expand All @@ -37,6 +39,16 @@
from google.pubsub_v1.types import pubsub as pubsub_gapic_types


TimeoutType = Union[
None,
Copy link
Contributor

@jimfulton jimfulton May 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we mean to add None? Was this my fault?

This feels like an unintentional change. We didn't accept None before.

If we want to accept None, then I think we should update

https://github.com/googleapis/python-api-core/blob/7337c6b123735fb9ae5d0e54b4399275719c020c/google/api_core/gapic_v1/method.py#L66-L67

to treat None like DEFAULT.

Copy link
Contributor Author

@plamut plamut May 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we did, even though the argument description says otherwise. But the generated code actually used None as a default value for a supposedly float-only argument. :)

int,
float,
google.api_core.timeout.ConstantTimeout,
google.api_core.timeout.ExponentialTimeout,
]
"""The type of the timeout parameter of publisher client methods."""


# Define the default values for batching.
#
# This class is used when creating a publisher or subscriber client, and
Expand Down Expand Up @@ -206,6 +218,7 @@ def _get_protobuf_messages(module):
_local_modules = [pubsub_gapic_types]

names = [
"TimeoutType",
"BatchSettings",
"LimitExceededBehavior",
"PublishFlowControl",
Expand Down