Skip to content

Commit

Permalink
Pub/Sub: add timeout in argparse [(#2637)](GoogleCloudPlatform/python…
Browse files Browse the repository at this point in the history
  • Loading branch information
anguillanneuf authored Dec 18, 2019
1 parent 55cbff6 commit a17393c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions samples/snippets/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,17 +484,24 @@ def callback(message):
"receive", help=receive_messages.__doc__
)
receive_parser.add_argument("subscription_name")
receive_parser.add_argument("--timeout", default=None, type=float)

receive_with_custom_attributes_parser = subparsers.add_parser(
"receive-custom-attributes",
help=receive_messages_with_custom_attributes.__doc__,
)
receive_with_custom_attributes_parser.add_argument("subscription_name")
receive_with_custom_attributes_parser.add_argument(
"--timeout", default=None, type=float
)

receive_with_flow_control_parser = subparsers.add_parser(
"receive-flow-control", help=receive_messages_with_flow_control.__doc__
)
receive_with_flow_control_parser.add_argument("subscription_name")
receive_with_flow_control_parser.add_argument(
"--timeout", default=None, type=float
)

synchronous_pull_parser = subparsers.add_parser(
"receive-synchronously", help=synchronous_pull.__doc__
Expand All @@ -513,6 +520,9 @@ def callback(message):
"listen_for_errors", help=listen_for_errors.__doc__
)
listen_for_errors_parser.add_argument("subscription_name")
listen_for_errors_parser.add_argument(
"--timeout", default=None, type=float
)

args = parser.parse_args()

Expand Down

0 comments on commit a17393c

Please sign in to comment.