Removed saranwrap as an option for making db connections nonblocking in db_pool. Trying to keep changelog updated with my changes.

This commit is contained in:
Ryan Williams
2009-12-15 13:14:40 -08:00
parent 6aa03c961f
commit a2e43d63ba
3 changed files with 7 additions and 42 deletions

5
NEWS
View File

@@ -1,3 +1,8 @@
0.9.3
=====
* Removed saranwrap as an option for making db connections nonblocking in db_pool.
0.9.2 0.9.2
===== =====

View File

@@ -236,25 +236,6 @@ class BaseConnectionPool(Pool):
self.clear() self.clear()
class SaranwrappedConnectionPool(BaseConnectionPool):
"""A pool which gives out saranwrapped database connections.
"""
def create(self):
return self.connect(self._db_module,
self.connect_timeout,
*self._args,
**self._kwargs)
@classmethod
def connect(cls, db_module, connect_timeout, *args, **kw):
timeout = api.exc_after(connect_timeout, ConnectTimeout())
try:
from eventlet import saranwrap
return saranwrap.wrap(db_module).connect(*args, **kw)
finally:
timeout.cancel()
class TpooledConnectionPool(BaseConnectionPool): class TpooledConnectionPool(BaseConnectionPool):
"""A pool which gives out :class:`~eventlet.tpool.Proxy`-based database """A pool which gives out :class:`~eventlet.tpool.Proxy`-based database
connections. connections.

View File

@@ -448,23 +448,6 @@ class TestTpoolConnectionPool(TestDBConnectionPool):
super(TestTpoolConnectionPool, self).tearDown() super(TestTpoolConnectionPool, self).tearDown()
class TestSaranwrapConnectionPool(TestDBConnectionPool):
__test__ = False # so that nose doesn't try to execute this directly
def create_pool(self, max_size = 1, max_idle = 10, max_age = 10, connect_timeout= 0.5, module=None):
if module is None:
module = self._dbmodule
return db_pool.SaranwrappedConnectionPool(module,
min_size=0, max_size=max_size,
max_idle=max_idle, max_age=max_age,
connect_timeout=connect_timeout,
**self._auth)
def test_raising_create(self):
# *TODO: this fails because of saranwrap's unwillingness to
# wrap objects in tests, but it should be fixable
pass
class TestRawConnectionPool(TestDBConnectionPool): class TestRawConnectionPool(TestDBConnectionPool):
__test__ = False # so that nose doesn't try to execute this directly __test__ = False # so that nose doesn't try to execute this directly
def create_pool(self, max_size = 1, max_idle = 10, max_age = 10, connect_timeout= 0.5, module=None): def create_pool(self, max_size = 1, max_idle = 10, max_age = 10, connect_timeout= 0.5, module=None):
@@ -477,7 +460,7 @@ class TestRawConnectionPool(TestDBConnectionPool):
**self._auth) **self._auth)
def test_connection_timeout(self): def test_connection_timeout(self):
pass # not gonna work for raw connections because they're not nonblocking pass # not gonna work for raw connections because they're blocking
def get_auth(): def get_auth():
@@ -535,14 +518,10 @@ class TestMysqlConnectionPool(object):
del db del db
# for some reason the tpool test hangs if run after the saranwrap test
class Test01MysqlTpool(TestMysqlConnectionPool, TestTpoolConnectionPool, TestCase): class Test01MysqlTpool(TestMysqlConnectionPool, TestTpoolConnectionPool, TestCase):
pass pass
class Test02MysqlSaranwrap(TestMysqlConnectionPool, TestSaranwrapConnectionPool, TestCase): class Test02MysqlRaw(TestMysqlConnectionPool, TestRawConnectionPool, TestCase):
pass
class Test03MysqlRaw(TestMysqlConnectionPool, TestRawConnectionPool, TestCase):
pass pass