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

Commit 302eb45

Browse files
Set timeout to infinite for publishing with ordering keys enabled
1 parent 8c7e2a9 commit 302eb45

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

google/cloud/pubsub_v1/publisher/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,10 @@ def on_publish_done(future):
399399
transport = self._transport
400400
base_retry = transport._wrapped_methods[transport.publish]._retry
401401
retry = base_retry.with_deadline(2.0**32)
402+
timeout = 2.0**32
402403
elif retry is not None:
403404
retry = retry.with_deadline(2.0**32)
405+
timeout = 2.0**32
404406

405407
# Delegate the publishing to the sequencer.
406408
sequencer = self._get_or_create_sequencer(topic, ordering_key)

tests/unit/pubsub_v1/publisher/test_publisher_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def test_publish_with_ordering_key_uses_extended_retry_deadline(creds):
313313
_, kwargs = batch_class.call_args
314314

315315
batch_commit_retry = kwargs["commit_retry"]
316-
expected_retry = custom_retry.with_deadline(2.0**32)
316+
expected_retry = custom_retry.with_deadline(2.0**32).with_timeout(2.0**32)
317317
_assert_retries_equal(batch_commit_retry, expected_retry)
318318

319319

@@ -342,7 +342,6 @@ def test_publish_with_ordering_key_with_no_retry(creds):
342342
# Check the retry settings used for the batch.
343343
batch_class.assert_called_once()
344344

345-
346345
def test_publish_attrs_bytestring(creds):
347346
client = publisher.Client(credentials=creds)
348347

0 commit comments

Comments
 (0)