Sets the maximum number of connections per Session that will be opened for each host with :class:`~.HostDistance` equal to `host_distance`. The default is 2 for :attr:`~HostDistance.LOCAL` and 1 for :attr:`~HostDistance.REMOTE`. If :attr:`~.Cluster.protocol_
(self, host_distance, max_connections)
| 1609 | return self._max_connections_per_host[host_distance] |
| 1610 | |
| 1611 | def set_max_connections_per_host(self, host_distance, max_connections): |
| 1612 | """ |
| 1613 | Sets the maximum number of connections per Session that will be opened |
| 1614 | for each host with :class:`~.HostDistance` equal to `host_distance`. |
| 1615 | The default is 2 for :attr:`~HostDistance.LOCAL` and 1 for |
| 1616 | :attr:`~HostDistance.REMOTE`. |
| 1617 | |
| 1618 | If :attr:`~.Cluster.protocol_version` is set to 3 or higher, this |
| 1619 | is not supported (there is always one connection per host, unless |
| 1620 | the host is remote and :attr:`connect_to_remote_hosts` is :const:`False`) |
| 1621 | and using this will result in an :exc:`~.UnsupportedOperation`. |
| 1622 | """ |
| 1623 | if self.protocol_version >= 3: |
| 1624 | raise UnsupportedOperation( |
| 1625 | "Cluster.set_max_connections_per_host() only has an effect " |
| 1626 | "when using protocol_version 1 or 2.") |
| 1627 | self._max_connections_per_host[host_distance] = max_connections |
| 1628 | |
| 1629 | def connection_factory(self, endpoint, *args, **kwargs): |
| 1630 | """ |