summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tradefed_cluster/util/BUILD1
-rw-r--r--tradefed_cluster/util/pubsub_client.py3
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.