Commit 285662a4 authored by Sebastien Robin's avatar Sebastien Robin

Fixed cases where two distinct connections where opened for the

same connector, the same thread, within a single transaction. It
fixes some possible lock wait timeout when two distinct connections
were used instead of one.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36628 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1bfd8741
...@@ -97,6 +97,7 @@ from App.ImageFile import ImageFile ...@@ -97,6 +97,7 @@ from App.ImageFile import ImageFile
from ExtensionClass import Base from ExtensionClass import Base
from DateTime import DateTime from DateTime import DateTime
from thread import allocate_lock from thread import allocate_lock
from Acquisition import aq_parent
manage_addZMySQLConnectionForm=HTMLFile('connectionAdd',globals()) manage_addZMySQLConnectionForm=HTMLFile('connectionAdd',globals())
...@@ -123,6 +124,12 @@ class Connection(DABase.Connection): ...@@ -123,6 +124,12 @@ class Connection(DABase.Connection):
def factory(self): return ThreadedDB def factory(self): return ThreadedDB
def connect(self, s): def connect(self, s):
# if acquisition wrappers are not there, do not connect in order to prevent
# having 2 distinct connections for the same connector. Without this
# two following lines, there is in the pool for the same connector two connections,
# one for (connection_id,) and another one for (some, path, connection_id,)
if aq_parent(self) is None:
return self
try: try:
database_connection_pool_lock.acquire() database_connection_pool_lock.acquire()
self._v_connected = '' self._v_connected = ''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment