Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Commit 05dd571

Browse files
fix: use retry_async instead of retry in async client (#1030)
* chore: Update gapic-generator-python to v1.12.0 PiperOrigin-RevId: 586356061 Source-Link: googleapis/googleapis@72a1f55 Source-Link: googleapis/googleapis-gen@558a04b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU4YTA0YmNkMWNjMDU3NmU4ZmFjMTA4OWU0OGU0OGIyN2FjMTYxYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.13.0 PiperOrigin-RevId: 586460538 Source-Link: googleapis/googleapis@44582d0 Source-Link: googleapis/googleapis-gen@5e7073c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWU3MDczYzlkZTg0NzkyOWM0YWU5N2Y4YTQ0NGMzZmNhMmQ0NWE2YiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 6cfafaa commit 05dd571

File tree

3 files changed

+88
-89
lines changed

3 files changed

+88
-89
lines changed

google/pubsub_v1/services/publisher/async_client.py

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@
3333
from google.api_core.client_options import ClientOptions
3434
from google.api_core import exceptions as core_exceptions
3535
from google.api_core import gapic_v1
36-
from google.api_core import retry as retries
37-
from google.api_core import timeout as timeouts # type: ignore
36+
from google.api_core import retry_async as retries
3837
from google.auth import credentials as ga_credentials # type: ignore
3938
from google.oauth2 import service_account # type: ignore
4039

4140
try:
42-
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
41+
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
4342
except AttributeError: # pragma: NO COVER
44-
OptionalRetry = Union[retries.Retry, object] # type: ignore
43+
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore
4544

4645
from google.iam.v1 import iam_policy_pb2 # type: ignore
4746
from google.iam.v1 import policy_pb2 # type: ignore
@@ -274,7 +273,7 @@ async def sample_create_topic():
274273
This corresponds to the ``name`` field
275274
on the ``request`` instance; if ``request`` is provided, this
276275
should not be set.
277-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
276+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
278277
should be retried.
279278
timeout (TimeoutType):
280279
The timeout for this request.
@@ -306,7 +305,7 @@ async def sample_create_topic():
306305
# and friendly error handling.
307306
rpc = gapic_v1.method_async.wrap_method(
308307
self._client._transport.create_topic,
309-
default_retry=retries.Retry(
308+
default_retry=retries.AsyncRetry(
310309
initial=0.1,
311310
maximum=60.0,
312311
multiplier=1.3,
@@ -398,7 +397,7 @@ async def sample_update_topic():
398397
This corresponds to the ``update_mask`` field
399398
on the ``request`` instance; if ``request`` is provided, this
400399
should not be set.
401-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
400+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
402401
should be retried.
403402
timeout (TimeoutType):
404403
The timeout for this request.
@@ -432,7 +431,7 @@ async def sample_update_topic():
432431
# and friendly error handling.
433432
rpc = gapic_v1.method_async.wrap_method(
434433
self._client._transport.update_topic,
435-
default_retry=retries.Retry(
434+
default_retry=retries.AsyncRetry(
436435
initial=0.1,
437436
maximum=60.0,
438437
multiplier=1.3,
@@ -519,7 +518,7 @@ async def sample_publish():
519518
This corresponds to the ``messages`` field
520519
on the ``request`` instance; if ``request`` is provided, this
521520
should not be set.
522-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
521+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
523522
should be retried.
524523
timeout (TimeoutType):
525524
The timeout for this request.
@@ -553,7 +552,7 @@ async def sample_publish():
553552
# and friendly error handling.
554553
rpc = gapic_v1.method_async.wrap_method(
555554
self._client._transport.publish,
556-
default_retry=retries.Retry(
555+
default_retry=retries.AsyncRetry(
557556
initial=0.1,
558557
maximum=60.0,
559558
multiplier=4.0,
@@ -636,7 +635,7 @@ async def sample_get_topic():
636635
This corresponds to the ``topic`` field
637636
on the ``request`` instance; if ``request`` is provided, this
638637
should not be set.
639-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
638+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
640639
should be retried.
641640
timeout (TimeoutType):
642641
The timeout for this request.
@@ -668,7 +667,7 @@ async def sample_get_topic():
668667
# and friendly error handling.
669668
rpc = gapic_v1.method_async.wrap_method(
670669
self._client._transport.get_topic,
671-
default_retry=retries.Retry(
670+
default_retry=retries.AsyncRetry(
672671
initial=0.1,
673672
maximum=60.0,
674673
multiplier=1.3,
@@ -748,7 +747,7 @@ async def sample_list_topics():
748747
This corresponds to the ``project`` field
749748
on the ``request`` instance; if ``request`` is provided, this
750749
should not be set.
751-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
750+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
752751
should be retried.
753752
timeout (TimeoutType):
754753
The timeout for this request.
@@ -784,7 +783,7 @@ async def sample_list_topics():
784783
# and friendly error handling.
785784
rpc = gapic_v1.method_async.wrap_method(
786785
self._client._transport.list_topics,
787-
default_retry=retries.Retry(
786+
default_retry=retries.AsyncRetry(
788787
initial=0.1,
789788
maximum=60.0,
790789
multiplier=1.3,
@@ -875,7 +874,7 @@ async def sample_list_topic_subscriptions():
875874
This corresponds to the ``topic`` field
876875
on the ``request`` instance; if ``request`` is provided, this
877876
should not be set.
878-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
877+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
879878
should be retried.
880879
timeout (TimeoutType):
881880
The timeout for this request.
@@ -911,7 +910,7 @@ async def sample_list_topic_subscriptions():
911910
# and friendly error handling.
912911
rpc = gapic_v1.method_async.wrap_method(
913912
self._client._transport.list_topic_subscriptions,
914-
default_retry=retries.Retry(
913+
default_retry=retries.AsyncRetry(
915914
initial=0.1,
916915
maximum=60.0,
917916
multiplier=1.3,
@@ -1006,7 +1005,7 @@ async def sample_list_topic_snapshots():
10061005
This corresponds to the ``topic`` field
10071006
on the ``request`` instance; if ``request`` is provided, this
10081007
should not be set.
1009-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1008+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
10101009
should be retried.
10111010
timeout (TimeoutType):
10121011
The timeout for this request.
@@ -1042,7 +1041,7 @@ async def sample_list_topic_snapshots():
10421041
# and friendly error handling.
10431042
rpc = gapic_v1.method_async.wrap_method(
10441043
self._client._transport.list_topic_snapshots,
1045-
default_retry=retries.Retry(
1044+
default_retry=retries.AsyncRetry(
10461045
initial=0.1,
10471046
maximum=60.0,
10481047
multiplier=1.3,
@@ -1132,7 +1131,7 @@ async def sample_delete_topic():
11321131
This corresponds to the ``topic`` field
11331132
on the ``request`` instance; if ``request`` is provided, this
11341133
should not be set.
1135-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1134+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
11361135
should be retried.
11371136
timeout (TimeoutType):
11381137
The timeout for this request.
@@ -1160,7 +1159,7 @@ async def sample_delete_topic():
11601159
# and friendly error handling.
11611160
rpc = gapic_v1.method_async.wrap_method(
11621161
self._client._transport.delete_topic,
1163-
default_retry=retries.Retry(
1162+
default_retry=retries.AsyncRetry(
11641163
initial=0.1,
11651164
maximum=60.0,
11661165
multiplier=1.3,
@@ -1231,7 +1230,7 @@ async def sample_detach_subscription():
12311230
request (Optional[Union[google.pubsub_v1.types.DetachSubscriptionRequest, dict]]):
12321231
The request object. Request for the DetachSubscription
12331232
method.
1234-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1233+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
12351234
should be retried.
12361235
timeout (TimeoutType):
12371236
The timeout for this request.
@@ -1251,7 +1250,7 @@ async def sample_detach_subscription():
12511250
# and friendly error handling.
12521251
rpc = gapic_v1.method_async.wrap_method(
12531252
self._client._transport.detach_subscription,
1254-
default_retry=retries.Retry(
1253+
default_retry=retries.AsyncRetry(
12551254
initial=0.1,
12561255
maximum=60.0,
12571256
multiplier=1.3,
@@ -1299,7 +1298,7 @@ async def set_iam_policy(
12991298
request (:class:`~.policy_pb2.SetIamPolicyRequest`):
13001299
The request object. Request message for `SetIamPolicy`
13011300
method.
1302-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1301+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
13031302
should be retried.
13041303
timeout (TimeoutType):
13051304
The timeout for this request.
@@ -1420,7 +1419,7 @@ async def get_iam_policy(
14201419
request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
14211420
The request object. Request message for `GetIamPolicy`
14221421
method.
1423-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1422+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
14241423
should be retried.
14251424
timeout (TimeoutType):
14261425
The timeout for this request.
@@ -1543,7 +1542,7 @@ async def test_iam_permissions(
15431542
request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
15441543
The request object. Request message for
15451544
`TestIamPermissions` method.
1546-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1545+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
15471546
should be retried.
15481547
timeout (TimeoutType):
15491548
The timeout for this request.

0 commit comments

Comments
 (0)