Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: remove grpc send/recieve limits (#259)
  • Loading branch information
yoshi-automation committed Dec 23, 2020
1 parent 3d6a29d commit fd2840c
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 10 deletions.
4 changes: 2 additions & 2 deletions google/pubsub_v1/__init__.py
Expand Up @@ -90,7 +90,6 @@
"ModifyPushConfigRequest",
"PublishRequest",
"PublishResponse",
"PublisherClient",
"PubsubMessage",
"PullRequest",
"PullResponse",
Expand All @@ -102,10 +101,11 @@
"Snapshot",
"StreamingPullRequest",
"StreamingPullResponse",
"SubscriberClient",
"Subscription",
"Topic",
"UpdateSnapshotRequest",
"UpdateSubscriptionRequest",
"UpdateTopicRequest",
"SubscriberClient",
"PublisherClient",
)
1 change: 0 additions & 1 deletion google/pubsub_v1/services/publisher/transports/__init__.py
Expand Up @@ -28,7 +28,6 @@
_transport_registry["grpc"] = PublisherGrpcTransport
_transport_registry["grpc_asyncio"] = PublisherGrpcAsyncIOTransport


__all__ = (
"PublisherTransport",
"PublisherGrpcTransport",
Expand Down
10 changes: 9 additions & 1 deletion google/pubsub_v1/services/publisher/transports/grpc.py
Expand Up @@ -150,6 +150,10 @@ def __init__(
ssl_credentials=ssl_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
self._ssl_channel_credentials = ssl_credentials
else:
Expand All @@ -168,6 +172,10 @@ def __init__(
ssl_credentials=ssl_channel_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)

self._stubs = {} # type: Dict[str, Callable]
Expand All @@ -194,7 +202,7 @@ def create_channel(
) -> grpc.Channel:
"""Create and return a gRPC channel object.
Args:
address (Optionsl[str]): The host for the channel to use.
address (Optional[str]): The host for the channel to use.
credentials (Optional[~.Credentials]): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If
Expand Down
Expand Up @@ -195,6 +195,10 @@ def __init__(
ssl_credentials=ssl_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
self._ssl_channel_credentials = ssl_credentials
else:
Expand All @@ -213,6 +217,10 @@ def __init__(
ssl_credentials=ssl_channel_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)

# Run the base constructor.
Expand Down
Expand Up @@ -28,7 +28,6 @@
_transport_registry["grpc"] = SubscriberGrpcTransport
_transport_registry["grpc_asyncio"] = SubscriberGrpcAsyncIOTransport


__all__ = (
"SubscriberTransport",
"SubscriberGrpcTransport",
Expand Down
10 changes: 9 additions & 1 deletion google/pubsub_v1/services/subscriber/transports/grpc.py
Expand Up @@ -152,6 +152,10 @@ def __init__(
ssl_credentials=ssl_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
self._ssl_channel_credentials = ssl_credentials
else:
Expand All @@ -170,6 +174,10 @@ def __init__(
ssl_credentials=ssl_channel_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)

self._stubs = {} # type: Dict[str, Callable]
Expand All @@ -196,7 +204,7 @@ def create_channel(
) -> grpc.Channel:
"""Create and return a gRPC channel object.
Args:
address (Optionsl[str]): The host for the channel to use.
address (Optional[str]): The host for the channel to use.
credentials (Optional[~.Credentials]): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If
Expand Down
Expand Up @@ -197,6 +197,10 @@ def __init__(
ssl_credentials=ssl_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
self._ssl_channel_credentials = ssl_credentials
else:
Expand All @@ -215,6 +219,10 @@ def __init__(
ssl_credentials=ssl_channel_credentials,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)

# Run the base constructor.
Expand Down
1 change: 0 additions & 1 deletion google/pubsub_v1/types/__init__.py
Expand Up @@ -61,7 +61,6 @@
SeekResponse,
)


__all__ = (
"MessageStoragePolicy",
"Topic",
Expand Down
6 changes: 3 additions & 3 deletions synth.metadata
Expand Up @@ -4,15 +4,15 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/python-pubsub.git",
"sha": "f3f4e5add32128bf238b2fbab3bcf0f5b23269d3"
"sha": "258414727827e56d2678ada28b9bbd88b5c6aa6f"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "53eb2512a55caabcbad1898225080a2a3dfcb6aa",
"internalRef": "346818879"
"sha": "0509f4bc8c86495f50a92f536bddc625797eda63",
"internalRef": "347398860"
}
},
{
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/gapic/pubsub_v1/test_publisher.py
Expand Up @@ -2672,6 +2672,10 @@ def test_publisher_transport_channel_mtls_with_client_cert_source(transport_clas
),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
assert transport.grpc_channel == mock_grpc_channel
assert transport._ssl_channel_credentials == mock_ssl_cred
Expand Down Expand Up @@ -2713,6 +2717,10 @@ def test_publisher_transport_channel_mtls_with_adc(transport_class):
),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
assert transport.grpc_channel == mock_grpc_channel

Expand Down
8 changes: 8 additions & 0 deletions tests/unit/gapic/pubsub_v1/test_subscriber.py
Expand Up @@ -3966,6 +3966,10 @@ def test_subscriber_transport_channel_mtls_with_client_cert_source(transport_cla
),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
assert transport.grpc_channel == mock_grpc_channel
assert transport._ssl_channel_credentials == mock_ssl_cred
Expand Down Expand Up @@ -4007,6 +4011,10 @@ def test_subscriber_transport_channel_mtls_with_adc(transport_class):
),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)
assert transport.grpc_channel == mock_grpc_channel

Expand Down

0 comments on commit fd2840c

Please sign in to comment.