Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion amqp/abstract_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def wait(self, method, callback=None, timeout=None, returns_tuple=False):

try:
while not p.ready:
self.connection.drain_events(timeout=timeout)
conn = self.connection
if conn is None:
raise RecoverableConnectionError('connection already closed')
conn.drain_events(timeout=timeout)
Comment thread
auvipy marked this conversation as resolved.

if p.value:
args, kwargs = p.value
Expand Down
7 changes: 7 additions & 0 deletions t/unit/test_abstract_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ def on_drain(*args, **kwargs):
self.c.wait([(50, 61)])
assert self.c._pending[(50, 61)] is prev

def test_wait__no_connection(self):
self.c.connection = None
with pytest.raises(RecoverableConnectionError,
match='connection already closed'):
self.c.wait((50, 61))
assert (50, 61) not in self.c._pending

def test_dispatch_method__content_encoding(self):
self.c.auto_decode = True
self.method.args = None
Expand Down
Loading