summaryrefslogtreecommitdiff
path: root/openerp/sql_db.py
diff options
context:
space:
mode:
authorAntony Lesuisse <al@openerp.com>2014-01-22 23:15:25 +0100
committerAntony Lesuisse <al@openerp.com>2014-01-22 23:15:25 +0100
commit9248a2db18b483cbcd403558a6fb7ab75d5e9a8b (patch)
treee74c5e25bf56666274eae16eef260c7abf12e07a /openerp/sql_db.py
parent7dd432cd5deab38be514a4bdb57a7f482d03cf33 (diff)
[FIX] multiprocess mode, empty the cursor pool before forking
bzr revid: al@openerp.com-20140122221525-hify023pk5i8d0jm
Diffstat (limited to 'openerp/sql_db.py')
-rw-r--r--openerp/sql_db.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/openerp/sql_db.py b/openerp/sql_db.py
index 7a58a5fc515..de9d21dcd82 100644
--- a/openerp/sql_db.py
+++ b/openerp/sql_db.py
@@ -27,9 +27,6 @@ the database, *not* a database abstraction toolkit. Database abstraction is what
the ORM does, in fact.
"""
-
-__all__ = ['db_connect', 'close_db']
-
from functools import wraps
import logging
import psycopg2.extensions
@@ -457,10 +454,10 @@ class ConnectionPool(object):
raise PoolError('This connection does not below to the pool')
@locked
- def close_all(self, dsn):
+ def close_all(self, dsn=None):
_logger.info('%r: Close all connections to %r', self, dsn)
for i, (cnx, used) in tools.reverse_enumerate(self._connections):
- if dsn_are_equals(cnx.dsn, dsn):
+ if dsn is None or dsn_are_equals(cnx.dsn, dsn):
cnx.close()
self._connections.pop(i)
@@ -522,6 +519,11 @@ def close_db(db_name):
if _Pool:
_Pool.close_all(dsn(db_name))
+def close_all():
+ global _Pool
+ if _Pool:
+ _Pool.close_all()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: