virtual: Prefetch count was totally broken, because of a logic error

This commit is contained in:
Ask Solem 2010-11-08 13:35:11 +01:00
parent 743fe9abb2
commit 4cfe6798cb
1 changed files with 3 additions and 1 deletions

View File

@ -79,7 +79,7 @@ class QoS(object):
"""
pcount = self.prefetch_count
return (not pcount or len(self._delivered) > pcount)
return (not pcount or len(self._delivered) < pcount)
def append(self, message, delivery_tag):
"""Append message to transactional state."""
@ -236,6 +236,7 @@ class Channel(AbstractChannel):
self._consumers = set()
self._tag_to_queue = {}
self._qos = None
self.closed = False
# instantiate exchange types
self.exchange_types = dict((typ, cls(self))
@ -429,6 +430,7 @@ class Channel(AbstractChannel):
def close(self):
"""Close channel, cancel all consumers, and requeue unacked
messages."""
self.closed = True
map(self.basic_cancel, list(self._consumers))
self.qos.restore_unacked_once()
self.connection.close_channel(self)