Skip to content

Conversation

@rnagaraj13
Copy link

When a subscription already exists, update it with current configuration instead of silently ignoring the AlreadyExists exception. This allows workers to automatically sync subscription settings (ack_deadline_seconds, expiration_policy, message_retention_duration, filters) without manual intervention in GCP Console.

Fixes #2444

When a subscription already exists, update it with current configuration
instead of silently ignoring the AlreadyExists exception.  This allows
workers to automatically sync subscription settings (ack_deadline_seconds,
expiration_policy, message_retention_duration, filters) without manual
intervention in GCP Console.

Fixes celery#2444
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 pull request adds automatic synchronization of GCP Pub/Sub subscription settings when configuration changes are detected. Previously, when a subscription already existed, Kombu would silently ignore the AlreadyExists exception and not apply any configuration updates, requiring manual intervention in the GCP Console.

Changes:

  • Modified _create_subscription to update existing subscriptions with current configuration instead of silently ignoring them
  • Added comprehensive test coverage for the subscription update functionality including filter handling and graceful error recovery
  • Moved subscription config creation outside the try block to enable reuse in both creation and update paths

Reviewed changes

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

File Description
kombu/transport/gcpubsub.py Implements subscription update logic in the AlreadyExists exception handler, using Google Cloud's update_subscription API with appropriate FieldMask to sync ack_deadline_seconds, expiration_policy.ttl, message_retention_duration, and optional filter settings
t/unit/transport/test_gcpubsub.py Adds comprehensive unit tests covering subscription updates when subscriptions exist, filter inclusion in update masks, and graceful handling of update failures

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

@auvipy auvipy added this to the 5.7.0 milestone Jan 18, 2026
@codecov
Copy link

codecov bot commented Jan 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.22%. Comparing base (3a6f84f) to head (c26bff3).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2445      +/-   ##
==========================================
+ Coverage   81.19%   81.22%   +0.02%     
==========================================
  Files          77       77              
  Lines        9738     9750      +12     
  Branches     1098     1099       +1     
==========================================
+ Hits         7907     7919      +12     
  Misses       1625     1625              
  Partials      206      206              

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

@rnagaraj13 rnagaraj13 requested a review from Copilot January 19, 2026 15:47
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.

@rnagaraj13 rnagaraj13 requested a review from Copilot January 19, 2026 15:50
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 1 comment.


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

@rnagaraj13 rnagaraj13 requested a review from Copilot January 19, 2026 15:55
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 1 comment.


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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GCP Pub/Sub: Update existing subscriptions when configuration changes instead of silently ignoring

2 participants