Skip to content

fix: add missing retry to publisher.publish in gcpubsub _put#2465

Open
poolik wants to merge 6 commits intocelery:mainfrom
poolik:fix/gcpubsub-publish-retry
Open

fix: add missing retry to publisher.publish in gcpubsub _put#2465
poolik wants to merge 6 commits intocelery:mainfrom
poolik:fix/gcpubsub-publish-retry

Conversation

@poolik
Copy link

@poolik poolik commented Feb 13, 2026

The publish call in _put was missing a retry parameter, unlike _put_fanout which already had one. This could cause transient failures to propagate immediately instead of being retried.

poolik and others added 2 commits February 13, 2026 09:49
The publish call in _put was missing a retry parameter, unlike
_put_fanout which already had one. This could cause transient
failures to propagate immediately instead of being retried.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a missing retry configuration in the GCP Pub/Sub transport's _put method. The publisher.publish call in _put was missing the retry parameter that was already present in the analogous _put_fanout method and all other GCP Pub/Sub API calls throughout the file. This inconsistency could cause transient failures in direct queue publishing to propagate immediately instead of being retried.

Changes:

  • Added retry=Retry(deadline=self.retry_timeout_seconds) parameter to the publisher.publish call in the _put method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.13%. Comparing base (d5f16d5) to head (ea640d0).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2465   +/-   ##
=======================================
  Coverage   81.13%   81.13%           
=======================================
  Files          77       77           
  Lines        9775     9775           
  Branches     1104     1104           
=======================================
  Hits         7931     7931           
  Misses       1636     1636           
  Partials      208      208           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this be better adding extra Unit test for this?

@auvipy auvipy added the GCP label Feb 16, 2026
@auvipy auvipy added this to the 5.7.0 milestone Feb 16, 2026
poolik and others added 2 commits February 18, 2026 14:58
@poolik
Copy link
Author

poolik commented Feb 18, 2026

@auvipy I've added unit test as well :)

@poolik poolik requested a review from auvipy February 18, 2026 13:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +360 to +362
call_kwargs = channel.publisher.publish.call_args[1]
assert isinstance(call_kwargs['retry'], Retry)
assert call_kwargs['retry']._timeout == 60
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion relies on the private Retry._timeout attribute, which is version-dependent and can make the test brittle. Consider validating the Retry configuration without reaching into private internals (e.g., by patching kombu.transport.gcpubsub.Retry and asserting it was called with the expected deadline).

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please cross check this suggestion?

Comment on lines +340 to +342
call_kwargs = channel.publisher.publish.call_args[1]
assert isinstance(call_kwargs['retry'], Retry)
assert call_kwargs['retry']._timeout == 300
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is asserting against Retry's private attribute ._timeout. This is not part of the public API and can change across google-api-core versions (and may not reflect the value passed via deadline=). Prefer asserting via a stable interface (e.g., patching kombu.transport.gcpubsub.Retry and checking it was constructed with deadline=..., or asserting on a public property if one exists in the supported versions).

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and please fix the merge conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants