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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested fix to exception due to Timeout argument being string type in snippet sample sub.py. #1018

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
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
4 changes: 2 additions & 2 deletions samples/snippets/quickstart/sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def callback(message: pubsub_v1.subscriber.message.Message) -> None:
try:
# Calling result() on StreamingPullFuture keeps the main thread from
# exiting while messages get processed in the callbacks.
streaming_pull_future.result(timeout=timeout)
streaming_pull_future.result(timeout=timeout and float(timeout))
pradn marked this conversation as resolved.
Show resolved Hide resolved
except: # noqa
streaming_pull_future.cancel() # Trigger the shutdown.
streaming_pull_future.result() # Block until the shutdown is complete.
Expand All @@ -57,7 +57,7 @@ def callback(message: pubsub_v1.subscriber.message.Message) -> None:
parser.add_argument("project_id", help="Google Cloud project ID")
parser.add_argument("subscription_id", help="Pub/Sub subscription ID")
parser.add_argument(
"timeout", default=None, nargs="?", const=1, help="Pub/Sub subscription ID"
"timeout", default=None, nargs="?", const=1, help="Subscription Timeout in seconds"
)

args = parser.parse_args()
Expand Down