-
-
Notifications
You must be signed in to change notification settings - Fork 974
fix: ensure hub close does also remove global event loop reference #2404
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
fix: ensure hub close does also remove global event loop reference #2404
Conversation
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 PR adds functionality to automatically clear the global event loop reference when a Hub instance is closed, preventing potential issues with dangling references. The implementation ensures that only the Hub that is currently set as the global event loop gets cleared when closed.
Key Changes
- Modified
Hub.close()to clear the global event loop variable if the closing hub is the current loop - Added two new test cases to verify the behavior: one for clearing when the hub is current, another for not clearing when a different hub is current
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| kombu/asynchronous/hub.py | Added logic in close() method to clear global _current_loop if it matches the closing hub instance |
| t/unit/asynchronous/test_hub.py | Added two test cases to verify the new global event loop cleanup behavior |
💡 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 #2404 +/- ##
=======================================
Coverage 81.15% 81.16%
=======================================
Files 77 77
Lines 9717 9719 +2
Branches 1094 1095 +1
=======================================
+ Hits 7886 7888 +2
Misses 1625 1625
Partials 206 206 ☔ View full report in Codecov by Sentry. |
|
Will do the linter stuff when I'm home. |
auvipy
left a comment
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.
please also fix the lint errors
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 no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
See celery/celery#9983.