Commit 9ec55c99 authored by Vincent Pelletier's avatar Vincent Pelletier

Make _getMasterConnection lockless in best case.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1758 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 70284a0e
......@@ -216,14 +216,16 @@ class Application(object):
def _getMasterConnection(self):
""" Connect to the primary master node on demand """
# acquire the lock to allow only one thread to connect to the primary
result = self.master_conn
if result is None:
self._connecting_to_master_node_acquire()
try:
if self.master_conn is None:
self.new_oid_list = []
self.master_conn = self._connectToPrimaryNode()
return self.master_conn
result = self._connectToPrimaryNode()
self.master_conn = result
finally:
self._connecting_to_master_node_release()
return result
def _getPartitionTable(self):
""" Return the partition table manager, reconnect the PMN if needed """
......
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