| 688 | self._session.submit(self._create_new_connection) |
| 689 | |
| 690 | def _create_new_connection(self): |
| 691 | try: |
| 692 | self._add_conn_if_under_max() |
| 693 | except (ConnectionException, socket.error) as exc: |
| 694 | log.warning("Failed to create new connection to %s: %s", self.host, exc) |
| 695 | except Exception: |
| 696 | log.exception("Unexpectedly failed to create new connection") |
| 697 | finally: |
| 698 | with self._lock: |
| 699 | self._scheduled_for_creation -= 1 |
| 700 | |
| 701 | def _add_conn_if_under_max(self): |
| 702 | max_conns = self._session.cluster.get_max_connections_per_host(self.host_distance) |