diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-08-05 15:11:52 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-08-05 15:11:52 +0000 |
| commit | 2d95e9daec3d44bd8d5725cf0b48cd583f8c2954 (patch) | |
| tree | 20be0cbdee7d4b8f50b9e66f57ede2020b47e69d /lib/sqlalchemy/pool.py | |
| parent | 110eb68e1a67447ab35f8d20493188ae85dfc180 (diff) | |
| download | sqlalchemy-2d95e9daec3d44bd8d5725cf0b48cd583f8c2954.tar.gz | |
temporary workaround dispose_local() added to SingletonThreadPool
for sqlite applications that dispose of threads en masse
Diffstat (limited to 'lib/sqlalchemy/pool.py')
| -rw-r--r-- | lib/sqlalchemy/pool.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index d71f645a6..dd27755c5 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -197,7 +197,13 @@ class SingletonThreadPool(Pool): # sqlite won't even let you close a conn from a thread that didn't create it pass del self._conns[key] - + + def dispose_local(self): + try: + del self._conns[thread.get_ident()] + except KeyError: + pass + def status(self): return "SingletonThreadPool id:%d thread:%d size: %d" % (id(self), thread.get_ident(), len(self._conns)) |
