Skip to content

Commit 49cd9a9

Browse files
fix: remove gRPC send/recv limits (#245)
1 parent 3ed9f4d commit 49cd9a9

File tree

70 files changed

+817
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+817
-126
lines changed

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@
139139
"EntityTypeBatch",
140140
"EntityTypesClient",
141141
"Environment",
142-
"EnvironmentsClient",
143142
"EventInput",
144143
"ExportAgentRequest",
145144
"ExportAgentResponse",
@@ -179,6 +178,7 @@
179178
"SentimentAnalysisResult",
180179
"SessionEntityType",
181180
"SessionEntityTypesClient",
181+
"SessionsClient",
182182
"SetAgentRequest",
183183
"SpeechContext",
184184
"SpeechModelVariant",
@@ -199,5 +199,5 @@
199199
"VoiceSelectionParams",
200200
"WebhookRequest",
201201
"WebhookResponse",
202-
"SessionsClient",
202+
"EnvironmentsClient",
203203
)

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/services/agents/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = AgentsGrpcTransport
2929
_transport_registry["grpc_asyncio"] = AgentsGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"AgentsTransport",
3433
"AgentsGrpcTransport",

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/services/agents/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ def __init__(
151151
ssl_credentials=ssl_credentials,
152152
scopes=scopes or self.AUTH_SCOPES,
153153
quota_project_id=quota_project_id,
154+
options=[
155+
("grpc.max_send_message_length", -1),
156+
("grpc.max_receive_message_length", -1),
157+
],
154158
)
155159
self._ssl_channel_credentials = ssl_credentials
156160
else:
@@ -169,9 +173,14 @@ def __init__(
169173
ssl_credentials=ssl_channel_credentials,
170174
scopes=scopes or self.AUTH_SCOPES,
171175
quota_project_id=quota_project_id,
176+
options=[
177+
("grpc.max_send_message_length", -1),
178+
("grpc.max_receive_message_length", -1),
179+
],
172180
)
173181

174182
self._stubs = {} # type: Dict[str, Callable]
183+
self._operations_client = None
175184

176185
# Run the base constructor.
177186
super().__init__(
@@ -195,7 +204,7 @@ def create_channel(
195204
) -> grpc.Channel:
196205
"""Create and return a gRPC channel object.
197206
Args:
198-
address (Optionsl[str]): The host for the channel to use.
207+
address (Optional[str]): The host for the channel to use.
199208
credentials (Optional[~.Credentials]): The
200209
authorization credentials to attach to requests. These
201210
credentials identify this application to the service. If
@@ -242,13 +251,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
242251
client.
243252
"""
244253
# Sanity check: Only create a new client if we do not already have one.
245-
if "operations_client" not in self.__dict__:
246-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
247-
self.grpc_channel
248-
)
254+
if self._operations_client is None:
255+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
249256

250257
# Return the client from cache.
251-
return self.__dict__["operations_client"]
258+
return self._operations_client
252259

253260
@property
254261
def get_agent(self) -> Callable[[agent.GetAgentRequest], agent.Agent]:

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/services/agents/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ def __init__(
196196
ssl_credentials=ssl_credentials,
197197
scopes=scopes or self.AUTH_SCOPES,
198198
quota_project_id=quota_project_id,
199+
options=[
200+
("grpc.max_send_message_length", -1),
201+
("grpc.max_receive_message_length", -1),
202+
],
199203
)
200204
self._ssl_channel_credentials = ssl_credentials
201205
else:
@@ -214,6 +218,10 @@ def __init__(
214218
ssl_credentials=ssl_channel_credentials,
215219
scopes=scopes or self.AUTH_SCOPES,
216220
quota_project_id=quota_project_id,
221+
options=[
222+
("grpc.max_send_message_length", -1),
223+
("grpc.max_receive_message_length", -1),
224+
],
217225
)
218226

219227
# Run the base constructor.
@@ -227,6 +235,7 @@ def __init__(
227235
)
228236

229237
self._stubs = {}
238+
self._operations_client = None
230239

231240
@property
232241
def grpc_channel(self) -> aio.Channel:
@@ -246,13 +255,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
246255
client.
247256
"""
248257
# Sanity check: Only create a new client if we do not already have one.
249-
if "operations_client" not in self.__dict__:
250-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
258+
if self._operations_client is None:
259+
self._operations_client = operations_v1.OperationsAsyncClient(
251260
self.grpc_channel
252261
)
253262

254263
# Return the client from cache.
255-
return self.__dict__["operations_client"]
264+
return self._operations_client
256265

257266
@property
258267
def get_agent(self) -> Callable[[agent.GetAgentRequest], Awaitable[agent.Agent]]:

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/services/contexts/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = ContextsGrpcTransport
2929
_transport_registry["grpc_asyncio"] = ContextsGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"ContextsTransport",
3433
"ContextsGrpcTransport",

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/services/contexts/transports/grpc.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ def __init__(
148148
ssl_credentials=ssl_credentials,
149149
scopes=scopes or self.AUTH_SCOPES,
150150
quota_project_id=quota_project_id,
151+
options=[
152+
("grpc.max_send_message_length", -1),
153+
("grpc.max_receive_message_length", -1),
154+
],
151155
)
152156
self._ssl_channel_credentials = ssl_credentials
153157
else:
@@ -166,6 +170,10 @@ def __init__(
166170
ssl_credentials=ssl_channel_credentials,
167171
scopes=scopes or self.AUTH_SCOPES,
168172
quota_project_id=quota_project_id,
173+
options=[
174+
("grpc.max_send_message_length", -1),
175+
("grpc.max_receive_message_length", -1),
176+
],
169177
)
170178

171179
self._stubs = {} # type: Dict[str, Callable]
@@ -192,7 +200,7 @@ def create_channel(
192200
) -> grpc.Channel:
193201
"""Create and return a gRPC channel object.
194202
Args:
195-
address (Optionsl[str]): The host for the channel to use.
203+
address (Optional[str]): The host for the channel to use.
196204
credentials (Optional[~.Credentials]): The
197205
authorization credentials to attach to requests. These
198206
credentials identify this application to the service. If

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/services/contexts/transports/grpc_asyncio.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ def __init__(
193193
ssl_credentials=ssl_credentials,
194194
scopes=scopes or self.AUTH_SCOPES,
195195
quota_project_id=quota_project_id,
196+
options=[
197+
("grpc.max_send_message_length", -1),
198+
("grpc.max_receive_message_length", -1),
199+
],
196200
)
197201
self._ssl_channel_credentials = ssl_credentials
198202
else:
@@ -211,6 +215,10 @@ def __init__(
211215
ssl_credentials=ssl_channel_credentials,
212216
scopes=scopes or self.AUTH_SCOPES,
213217
quota_project_id=quota_project_id,
218+
options=[
219+
("grpc.max_send_message_length", -1),
220+
("grpc.max_receive_message_length", -1),
221+
],
214222
)
215223

216224
# Run the base constructor.

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/services/entity_types/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = EntityTypesGrpcTransport
2929
_transport_registry["grpc_asyncio"] = EntityTypesGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"EntityTypesTransport",
3433
"EntityTypesGrpcTransport",

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/services/entity_types/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ def __init__(
151151
ssl_credentials=ssl_credentials,
152152
scopes=scopes or self.AUTH_SCOPES,
153153
quota_project_id=quota_project_id,
154+
options=[
155+
("grpc.max_send_message_length", -1),
156+
("grpc.max_receive_message_length", -1),
157+
],
154158
)
155159
self._ssl_channel_credentials = ssl_credentials
156160
else:
@@ -169,9 +173,14 @@ def __init__(
169173
ssl_credentials=ssl_channel_credentials,
170174
scopes=scopes or self.AUTH_SCOPES,
171175
quota_project_id=quota_project_id,
176+
options=[
177+
("grpc.max_send_message_length", -1),
178+
("grpc.max_receive_message_length", -1),
179+
],
172180
)
173181

174182
self._stubs = {} # type: Dict[str, Callable]
183+
self._operations_client = None
175184

176185
# Run the base constructor.
177186
super().__init__(
@@ -195,7 +204,7 @@ def create_channel(
195204
) -> grpc.Channel:
196205
"""Create and return a gRPC channel object.
197206
Args:
198-
address (Optionsl[str]): The host for the channel to use.
207+
address (Optional[str]): The host for the channel to use.
199208
credentials (Optional[~.Credentials]): The
200209
authorization credentials to attach to requests. These
201210
credentials identify this application to the service. If
@@ -242,13 +251,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
242251
client.
243252
"""
244253
# Sanity check: Only create a new client if we do not already have one.
245-
if "operations_client" not in self.__dict__:
246-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
247-
self.grpc_channel
248-
)
254+
if self._operations_client is None:
255+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
249256

250257
# Return the client from cache.
251-
return self.__dict__["operations_client"]
258+
return self._operations_client
252259

253260
@property
254261
def list_entity_types(

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/services/entity_types/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ def __init__(
196196
ssl_credentials=ssl_credentials,
197197
scopes=scopes or self.AUTH_SCOPES,
198198
quota_project_id=quota_project_id,
199+
options=[
200+
("grpc.max_send_message_length", -1),
201+
("grpc.max_receive_message_length", -1),
202+
],
199203
)
200204
self._ssl_channel_credentials = ssl_credentials
201205
else:
@@ -214,6 +218,10 @@ def __init__(
214218
ssl_credentials=ssl_channel_credentials,
215219
scopes=scopes or self.AUTH_SCOPES,
216220
quota_project_id=quota_project_id,
221+
options=[
222+
("grpc.max_send_message_length", -1),
223+
("grpc.max_receive_message_length", -1),
224+
],
217225
)
218226

219227
# Run the base constructor.
@@ -227,6 +235,7 @@ def __init__(
227235
)
228236

229237
self._stubs = {}
238+
self._operations_client = None
230239

231240
@property
232241
def grpc_channel(self) -> aio.Channel:
@@ -246,13 +255,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
246255
client.
247256
"""
248257
# Sanity check: Only create a new client if we do not already have one.
249-
if "operations_client" not in self.__dict__:
250-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
258+
if self._operations_client is None:
259+
self._operations_client = operations_v1.OperationsAsyncClient(
251260
self.grpc_channel
252261
)
253262

254263
# Return the client from cache.
255-
return self.__dict__["operations_client"]
264+
return self._operations_client
256265

257266
@property
258267
def list_entity_types(

0 commit comments

Comments
 (0)