-
Notifications
You must be signed in to change notification settings - Fork 58
Return topic desctuctors #576
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -59,7 +59,11 @@ async def create_reader(): | |||||
|
||||||
def __del__(self): | ||||||
if not self._closed: | ||||||
logger.warning("Topic reader was not closed properly. Consider using method close().") | ||||||
try: | ||||||
logger.warning("Topic reader was not closed properly. Consider using method close().") | ||||||
self.close(flush=False) | ||||||
except BaseException: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Catching BaseException can mask unexpected issues; consider catching Exception instead to maintain clearer exception handling.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
logger.warning("Something went wrong during reader close in __del__") | ||||||
|
||||||
def __enter__(self): | ||||||
return self | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -75,7 +75,11 @@ def __exit__(self, exc_type, exc_val, exc_tb): | |||||
|
||||||
def __del__(self): | ||||||
if not self._closed: | ||||||
logger.warning("Topic writer was not closed properly. Consider using method close().") | ||||||
try: | ||||||
logger.warning("Topic writer was not closed properly. Consider using method close().") | ||||||
self.close(flush=False) | ||||||
except BaseException: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Catching BaseException here can hide severe exceptions; consider catching Exception instead to avoid suppression of critical errors.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
logger.warning("Something went wrong during writer close in __del__") | ||||||
|
||||||
def close(self, *, flush: bool = True, timeout: TimeoutType = None): | ||||||
if self._closed: | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -116,7 +116,11 @@ def __init__(self, driver: aio.Driver, settings: Optional[TopicClientSettings] = | |||||
|
||||||
def __del__(self): | ||||||
if not self._closed: | ||||||
logger.warning("Topic client was not closed properly. Consider using method close().") | ||||||
try: | ||||||
logger.warning("Topic client was not closed properly. Consider using method close().") | ||||||
self.close() | ||||||
except BaseException: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Catching BaseException may unintentionally swallow critical exceptions like KeyboardInterrupt; consider catching Exception instead.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
logger.warning("Something went wrong during topic client close in __del__") | ||||||
|
||||||
async def create_topic( | ||||||
self, | ||||||
|
@@ -348,7 +352,11 @@ def __init__(self, driver: driver.Driver, settings: Optional[TopicClientSettings | |||||
|
||||||
def __del__(self): | ||||||
if not self._closed: | ||||||
logger.warning("Topic client was not closed properly. Consider using method close().") | ||||||
try: | ||||||
logger.warning("Topic client was not closed properly. Consider using method close().") | ||||||
self.close() | ||||||
except BaseException: | ||||||
logger.warning("Something went wrong during topic client close in __del__") | ||||||
|
||||||
def create_topic( | ||||||
self, | ||||||
|
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.
Catching BaseException here might hide critical system exceptions; switching to Exception is recommended for more precise error handling.
Copilot uses AI. Check for mistakes.