Skip to content

Commit

Permalink
fix: correct connection closing
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik committed Jan 13, 2024
1 parent 0b8c7c9 commit 2c4c28a
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion faststream/broker/core/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,26 @@ async def close(
await h.close()

if self._connection is not None:
self._connection = None
await self._close(exc_type, exc_val, exec_tb)

@abstractmethod
async def _close(
self,
exc_type: Optional[Type[BaseException]] = None,
exc_val: Optional[BaseException] = None,
exec_tb: Optional["TracebackType"] = None,
) -> None:
"""Close the object.
Args:
exc_type: Optional. The type of the exception.
exc_val: Optional. The exception value.
exec_tb: Optional. The traceback of the exception.
Returns:
None
"""
self._connection = None

@abstractmethod
async def publish(
Expand Down

0 comments on commit 2c4c28a

Please sign in to comment.