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
3 changes: 2 additions & 1 deletion amqp/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ def collect(self):
if self._transport:
self._transport.close()

temp_list = [x for x in values(self.channels) if x is not self]
temp_list = [x for x in values(self.channels or {})
if x is not self]
for ch in temp_list:
ch.collect()
except socket.error:
Expand Down
5 changes: 5 additions & 0 deletions t/unit/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ def test_collect_no_transport(self):
self.conn.collect()
assert not self.conn.connect.called

def test_collect_again(self):
self.conn = Connection()
self.conn.collect()
self.conn.collect()

def test_get_free_channel_id__raises_IndexError(self):
self.conn._avail_channel_ids = []
with pytest.raises(ResourceError):
Expand Down