Package buildbot :: Package db :: Module dbspec :: Class ExpiringConnectionPool
[frames] | no frames]

Class ExpiringConnectionPool

source code

twisted.enterprise.adbapi.ConnectionPool --+
                                           |
                                          ExpiringConnectionPool

A Connection pool that expires connections after a certain amount of idle time.

Instance Methods
 
__init__(self, dbapiName, max_idle=60, *args, **kwargs)
Create a new ConnectionPool.
source code
 
connect(self)
Return a database connection when one becomes available.
source code
 
disconnect(self, conn)
Disconnect a database connection associated with this pool.
source code

Inherited from twisted.enterprise.adbapi.ConnectionPool: __getstate__, __setstate__, close, finalClose, runInteraction, runOperation, runQuery, runWithConnection, start

Class Variables

Inherited from twisted.enterprise.adbapi.ConnectionPool: CP_ARGS, good_sql, max, min, name, noisy, openfun, reconnect, running

Instance Variables

Inherited from twisted.enterprise.adbapi.ConnectionPool: connectionFactory, transactionFactory

Method Details

__init__(self, dbapiName, max_idle=60, *args, **kwargs)
(Constructor)

source code 

Create a new ConnectionPool.

Any positional or keyword arguments other than those documented here are passed to the DB-API object when connecting. Use these arguments to pass database names, usernames, passwords, etc.

Parameters:
  • max_idle - reconnect connections that have been idle more than this number of seconds.
Overrides: twisted.enterprise.adbapi.ConnectionPool.__init__

connect(self)

source code 

Return a database connection when one becomes available.

This method blocks and should be run in a thread from the internal threadpool. Don't call this method directly from non-threaded code. Using this method outside the external threadpool may exceed the maximum number of connections in the pool.

Returns:
a database connection from the pool.
Overrides: twisted.enterprise.adbapi.ConnectionPool.connect
(inherited documentation)

disconnect(self, conn)

source code 

Disconnect a database connection associated with this pool.

Note: This function should only be used by the same thread which called connect(). As with connect(), this function is not used in normal non-threaded twisted code.

Overrides: twisted.enterprise.adbapi.ConnectionPool.disconnect
(inherited documentation)