fix pools to use new Queue class
This commit is contained in:
@@ -95,7 +95,7 @@ class Pool(object):
|
|||||||
self.current_size -= 1
|
self.current_size -= 1
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.channel.sem.balance < 0:
|
if self.waiting():
|
||||||
self.channel.send(item)
|
self.channel.send(item)
|
||||||
else:
|
else:
|
||||||
if self.order_as_stack:
|
if self.order_as_stack:
|
||||||
@@ -116,10 +116,8 @@ class Pool(object):
|
|||||||
def waiting(self):
|
def waiting(self):
|
||||||
"""Return the number of routines waiting for a pool item.
|
"""Return the number of routines waiting for a pool item.
|
||||||
"""
|
"""
|
||||||
if self.channel.sem.balance < 0:
|
return self.channel.waiting()
|
||||||
return -self.channel.sem.balance
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def create(self):
|
def create(self):
|
||||||
"""Generate a new pool item
|
"""Generate a new pool item
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user