diff options
author | Google Team <no-reply@google.com> | 2023-04-10 11:51:59 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-04-10 11:52:32 -0700 |
commit | ef849ee47d58670bae7d160a3306a127339d9572 (patch) | |
tree | 636810a7692f7afdd351704ea1327ac78ea5386a | |
parent | b8b5d731068ff58089a445ce3f474e73d2aaee6f (diff) | |
download | tradefed_cluster-ef849ee47d58670bae7d160a3306a127339d9572.tar.gz |
Internal change
PiperOrigin-RevId: 523174284
Change-Id: Ica570a48fe8acdf743abc8d3d775c49edf015ddf
-rw-r--r-- | tradefed_cluster/util/BUILD | 1 | ||||
-rw-r--r-- | tradefed_cluster/util/pubsub_client.py | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/tradefed_cluster/util/BUILD b/tradefed_cluster/util/BUILD index 98d57ba..0738c17 100644 --- a/tradefed_cluster/util/BUILD +++ b/tradefed_cluster/util/BUILD @@ -123,6 +123,7 @@ pytype_strict_library( ], srcs_version = "PY2AND3", deps = [ + "//pyglib:retry", "//third_party/py/google/auth:__init__", third_party("googleapiclient"), ], diff --git a/tradefed_cluster/util/pubsub_client.py b/tradefed_cluster/util/pubsub_client.py index 9dfd8f0..cc9a3a4 100644 --- a/tradefed_cluster/util/pubsub_client.py +++ b/tradefed_cluster/util/pubsub_client.py @@ -19,6 +19,7 @@ import threading from googleapiclient import discovery from googleapiclient import errors +from google3.pyglib import retry PUBSUB_API_SCOPES = ('https://www.googleapis.com/auth/pubsub') PUBSUB_API_NAME = 'pubsub' @@ -64,6 +65,8 @@ class PubSubClient(object): raise logging.debug('Topic %s already exists', topic) + @retry.logged_retry_on_exception( + retry_value=errors.HttpError, retry_intervals=[10, 20]) def PublishMessages(self, topic, messages): """Publish messages to supplied topic. |