diff options
author | Christian Goetze <cg@lindenlab.com> | 2008-07-10 16:52:33 +0000 |
---|---|---|
committer | Christian Goetze <cg@lindenlab.com> | 2008-07-10 16:52:33 +0000 |
commit | 40d2bb564d35809d7735d2ec06ba988db7327020 (patch) | |
tree | d87f4272d64706fdd28ecdf0fe731bf20bbcfe26 /indra/lib/python/indra/ipc | |
parent | 81443ef2aa7bdb916eb4b38740db9ae3cd1c59cd (diff) |
QAR-622 merge -r91846:91877 svn+ssh://svn/svn/linden/branches/scut-newstyle-5
Diffstat (limited to 'indra/lib/python/indra/ipc')
-rw-r--r-- | indra/lib/python/indra/ipc/mysql_pool.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/indra/lib/python/indra/ipc/mysql_pool.py b/indra/lib/python/indra/ipc/mysql_pool.py index 2a5a916e74..a2324cf956 100644 --- a/indra/lib/python/indra/ipc/mysql_pool.py +++ b/indra/lib/python/indra/ipc/mysql_pool.py @@ -76,3 +76,15 @@ class ConnectionPool(db_pool.TpooledConnectionPool): converted_kwargs.update(self._kwargs) conn.connection_parameters = converted_kwargs return conn + + def clear(self): + """ Close all connections that this pool still holds a reference to, leaving it empty.""" + for conn in self.free_items: + try: + conn.close() + except: + pass # even if stuff happens here, we still want to at least try to close all the other connections + self.free_items.clear() + + def __del__(self): + self.clear() |