Skip to content

Commit a709418

Browse files
author
Daniil Dumchenko
committed
Fix: clear code
1 parent b395bd6 commit a709418

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

faststream/kafka/broker/broker.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,8 @@ async def publish_batch(
811811
@override
812812
async def ping(self, timeout: Optional[float]) -> bool:
813813
with move_on_after(timeout) as cancel_scope:
814-
if cancel_scope.cancel_called:
815-
return False
816-
else:
817-
return not self._producer._producer._closed
814+
return not (
815+
cancel_scope.cancel_called or
816+
self._producer is None or
817+
self._producer._producer._closed
818+
)

faststream/rabbit/broker/broker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,6 @@ async def ping(self, timeout: Optional[float]) -> bool:
662662
with move_on_after(timeout) as cancel_scope:
663663
if cancel_scope.cancel_called:
664664
return False
665-
if not self._connection or self._connection.is_closed or not self._connection.transport:
665+
if not self._connection or self._connection.is_closed:
666666
return False
667667
return True

0 commit comments

Comments
 (0)