Commit 28cba07d authored by Ron Rothman's avatar Ron Rothman Committed by Jason Madden

raise PoolFull, not Timeout

parent d4b00714
...@@ -734,8 +734,8 @@ class Pool(Group): ...@@ -734,8 +734,8 @@ class Pool(Group):
:keyword float timeout: The maximum number of seconds this method will :keyword float timeout: The maximum number of seconds this method will
block, if ``blocking`` is True. (Ignored if ``blocking`` is False.) block, if ``blocking`` is True. (Ignored if ``blocking`` is False.)
Raises ``Timeout`` on timeout, or `PoolFull` if ``blocking`` is False and Raises `PoolFull` if either ``blocking`` is False and the pool was full,
the pool is full. or if ``blocking`` is True and ``timeout`` was exceeded.
.. seealso:: :meth:`Group.add` .. seealso:: :meth:`Group.add`
...@@ -745,8 +745,8 @@ class Pool(Group): ...@@ -745,8 +745,8 @@ class Pool(Group):
if not self._semaphore.acquire(blocking=blocking, timeout=timeout): if not self._semaphore.acquire(blocking=blocking, timeout=timeout):
# We failed to acquire the semaphore. # We failed to acquire the semaphore.
# If blocking was True, then there was a timeout. If blocking was # If blocking was True, then there was a timeout. If blocking was
# False, then there was no capacity. # False, then there was no capacity. Either way, raise PoolFull.
raise Timeout() if blocking else PoolFull() raise PoolFull()
try: try:
Group.add(self, greenlet) Group.add(self, greenlet)
......
...@@ -226,7 +226,7 @@ class PoolBasicTests(greentest.TestCase): ...@@ -226,7 +226,7 @@ class PoolBasicTests(greentest.TestCase):
second = gevent.spawn(gevent.sleep, 1000) second = gevent.spawn(gevent.sleep, 1000)
try: try:
p.add(first) p.add(first)
with self.assertRaises(Timeout): with self.assertRaises(pool.PoolFull):
p.add(second, timeout=0.100) p.add(second, timeout=0.100)
finally: finally:
second.kill() second.kill()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment