Remove only_free param to Pool.get()
This is unused. I think I added it before iter_free(), i.e. empty() was going to be: for item in self.get(only_free=True): item.close() rather than: for item in self.iter_free(): item.close() Change-Id: Ie6d0de3b7453ee036412db10f37d26f04de73cf7
This commit is contained in:
parent
c719dc306b
commit
abf5b2bf5a
@ -45,21 +45,17 @@ class Pool(object):
|
||||
self._items.appendleft(item)
|
||||
self._cond.notify()
|
||||
|
||||
def get(self, only_free=False):
|
||||
def get(self):
|
||||
"""Return an item from the pool, when one is available.
|
||||
|
||||
This may cause the calling thread to block.
|
||||
|
||||
:param only_free: if True, return None if no free item available
|
||||
:type only_free: bool
|
||||
"""
|
||||
with self._cond:
|
||||
while True:
|
||||
try:
|
||||
return self._items.popleft()
|
||||
except IndexError:
|
||||
if only_free:
|
||||
return None
|
||||
pass
|
||||
|
||||
if self._current_size < self._max_size:
|
||||
self._current_size += 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user