Add HostConnectionPool.open_connections prop

this property required when metrics enabled with protocol_version=3
This commit is contained in:
Adam Holmberg
2015-02-18 17:00:44 -06:00
parent 077b876fdd
commit 08c2a043d9

View File

@@ -371,6 +371,10 @@ class HostConnection(object):
in_flights = [connection.in_flight] if connection else []
return {'shutdown': self.is_shutdown, 'open_count': open_count, 'in_flights': in_flights}
@property
def open_count(self):
connection = self._connection
return 1 if connection and not (connection.is_closed or connection.is_defunct) else 0
_MAX_SIMULTANEOUS_CREATION = 1
_MIN_TRASH_INTERVAL = 10