Skip to content

Commit

Permalink
Fixed bugs of exception logging (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
aborigeth authored Nov 4, 2024
1 parent e0bde68 commit 42a59fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions rstream/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@ async def close(self) -> None:
)

except asyncio.TimeoutError:
logger.warning("timeout in client close() sync_request:")
except BaseException as exc:
logger.exception("exception in client close() sync_request", exc)
logger.warning("timeout in client close() sync_request")
except BaseException:
logger.exception("exception in client close() sync_request")

self._is_not_closed = False
await asyncio.sleep(0.2)
Expand Down
2 changes: 1 addition & 1 deletion rstream/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ async def unsubscribe(self, subscriber_name: str) -> None:
except asyncio.TimeoutError:
logger.warning("timeout when closing consumer and deleting publisher")
except BaseException as exc:
logger.warning("exception in unsubscribe of Consumer:" + str(exc))
logger.warning("exception in unsubscribe of Consumer: %s", exc)

stream = subscriber.stream

Expand Down
16 changes: 8 additions & 8 deletions rstream/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ async def close(self) -> None:
await asyncio.wait_for(publisher.client.delete_publisher(publisher.id), 5)
except asyncio.TimeoutError:
logger.warning("timeout when closing producer and deleting publisher")
except BaseException as exc:
logger.exception("exception in delete_publisher in Producer.close:", exc)
except BaseException:
logger.exception("exception in delete_publisher in Producer.close")
publisher.client.remove_handler(schema.PublishConfirm, publisher.reference)
publisher.client.remove_handler(schema.PublishError, publisher.reference)
publisher.client.remove_handler(schema.MetadataUpdate, publisher.reference)
Expand Down Expand Up @@ -262,11 +262,11 @@ async def _get_or_create_publisher(

except StreamDoesNotExist as e:
await self._maybe_clean_up_during_lost_connection(stream)
logger.exception("Error in _get_or_create_publisher: stream does not exists anymore", e)
logger.exception("Error in _get_or_create_publisher: stream does not exists anymore")
raise e
except Exception as ex:
await self._maybe_clean_up_during_lost_connection(stream)
logger.exception("error declaring publisher: ", ex)
logger.exception("error declaring publisher")
raise ex

logger.debug("_get_or_create_publisher(): Adding handlers")
Expand Down Expand Up @@ -615,10 +615,10 @@ async def _timer(self):
for stream in self._buffered_messages:
try:
await self._publish_buffered_messages(stream)
except BaseException as exc:
logger.exception("producer _timer exception: ", {exc})
except Exception as ex:
logger.exception("exception in _timer: " + str(ex))
except BaseException:
logger.exception("producer _timer exception")
except Exception:
logger.exception("exception in _timer")

async def _publish_buffered_messages(self, stream: str) -> None:
logger.debug("publishing message with _publish_buffered_messages")
Expand Down

0 comments on commit 42a59fb

Please sign in to comment.