Skip to content

Commit

Permalink
Increase speech max received msg size to 256 MiB
Browse files Browse the repository at this point in the history
  • Loading branch information
plamut committed Jun 14, 2019
1 parent fc4590b commit 5459060
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def create_channel(cls, address="speech.googleapis.com:443", credentials=None):
grpc.Channel: A gRPC channel object.
"""
return google.api_core.grpc_helpers.create_channel(
address, credentials=credentials, scopes=cls._OAUTH_SCOPES
address,
credentials=credentials,
scopes=cls._OAUTH_SCOPES,
options={"grpc.max_receive_message_length": 256 * 1024 * 1024}.items(),
)

@property
Expand Down
10 changes: 5 additions & 5 deletions speech/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-06-06T12:32:47.200920Z",
"updateTime": "2019-06-14T14:10:23.081189Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.23.1",
"dockerImage": "googleapis/artman@sha256:9d5cae1454da64ac3a87028f8ef486b04889e351c83bb95e83b8fab3959faed0"
"version": "0.25.0",
"dockerImage": "googleapis/artman@sha256:ef1a98ab1e2b8f05f4d9a56f27d63347aefe14020e5f2d585172b14ca76f1d90"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "f03bf2139ee85aac88411d6c20a21f4c901fe83c",
"internalRef": "251806891"
"sha": "c23b68eecb00c4d285a730a49b1d7d943cd56183",
"internalRef": "253113405"
}
},
{
Expand Down
14 changes: 12 additions & 2 deletions speech/synth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Google LLC
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,7 @@
# Generate speech GAPIC layer
# ----------------------------------------------------------------------------
for version in versions:
library = gapic.py_library("speech", version, include_protos=True,)
library = gapic.py_library("speech", version, include_protos=True)

# Don't move over __init__.py, as we modify it to make the generated client
# use helpers.py.
Expand All @@ -55,6 +55,16 @@
r"from google.cloud.speech_\1.gapic import speech_client as speech_\1",
)

# Set the maximum received message size to 256 MiB, the default of 4 MiB is
# often insufficient in practice.
s.replace(
"google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py",
r".*scopes=cls\._OAUTH_SCOPES.*",
"""\g<0>
options={"grpc.max_receive_message_length": 256 * 1024 * 1024}.items()
""",
)

# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
Expand Down

0 comments on commit 5459060

Please sign in to comment.