MCPcopy
hub / github.com/redis/redis-py / get_connection_count

Method get_connection_count

redis/asyncio/connection.py:1737–1756  ·  view source on GitHub ↗

Returns a connection count (both idle and in use).

(self)

Source from the content-addressed store, hash-verified

1735 pass
1736
1737 def get_connection_count(self) -> List[tuple[int, dict]]:
1738 """
1739 Returns a connection count (both idle and in use).
1740 """
1741 attributes = AttributeBuilder.build_base_attributes()
1742 attributes[DB_CLIENT_CONNECTION_POOL_NAME] = get_pool_name(self)
1743 free_connections_attributes = attributes.copy()
1744 in_use_connections_attributes = attributes.copy()
1745
1746 free_connections_attributes[DB_CLIENT_CONNECTION_STATE] = (
1747 ConnectionState.IDLE.value
1748 )
1749 in_use_connections_attributes[DB_CLIENT_CONNECTION_STATE] = (
1750 ConnectionState.USED.value
1751 )
1752
1753 return [
1754 (len(self._available_connections), free_connections_attributes),
1755 (len(self._in_use_connections), in_use_connections_attributes),
1756 ]
1757
1758
1759class BlockingConnectionPool(ConnectionPool):

Callers 2

Calls 3

get_pool_nameFunction · 0.85
build_base_attributesMethod · 0.80
copyMethod · 0.80

Tested by

no test coverage detected