[Neo-report] r2577 gregory - /trunk/neo/client/pool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Dec 28 17:37:31 CET 2010
Author: gregory
Date: Tue Dec 28 17:37:30 2010
New Revision: 2577
Log:
Merge _createNodeConnection in getConnForNode.
So that search and add in connection_dict is made in the same method.
Modified:
trunk/neo/client/pool.py
Modified: trunk/neo/client/pool.py
==============================================================================
--- trunk/neo/client/pool.py [iso-8859-1] (original)
+++ trunk/neo/client/pool.py [iso-8859-1] Tue Dec 28 17:37:30 2010
@@ -113,18 +113,6 @@ class ConnectionPool(object):
conn.unlock()
@profiler_decorator
- def _createNodeConnection(self, node):
- """Create a connection to a given storage node."""
- if len(self.connection_dict) > self.max_pool_size:
- # must drop some unused connections
- self._dropConnections()
-
- conn = self._initNodeConnection(node)
- if conn is not None:
- self.connection_dict[node.getUUID()] = conn
- return conn
-
- @profiler_decorator
def notifyFailure(self, node):
self._notifyFailure(node.getUUID(), time.time() + MAX_FAILURE_AGE)
@@ -163,8 +151,14 @@ class ConnectionPool(object):
# Already connected to node
return self.connection_dict[uuid]
except KeyError:
+ if len(self.connection_dict) > self.max_pool_size:
+ # must drop some unused connections
+ self._dropConnections()
# Create new connection to node
- return self._createNodeConnection(node)
+ conn = self._initNodeConnection(node)
+ if conn is not None:
+ self.connection_dict[uuid] = conn
+ return conn
finally:
self.connection_lock_release()
More information about the Neo-report
mailing list