-
-
Notifications
You must be signed in to change notification settings - Fork 976
feat(gcpubsub): update existing subscriptions on config changes #2445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(gcpubsub): update existing subscriptions on config changes #2445
Conversation
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
There was a problem hiding this 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_subscriptionto 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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. |
There was a problem hiding this 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.
There was a problem hiding this 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.
There was a problem hiding this 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.
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