MCPcopy Index your code
hub / github.com/apache/cassandra-python-driver / _reconnect

Method _reconnect

cassandra/cluster.py:3721–3745  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3719 self._submit(self._reconnect)
3720
3721 def _reconnect(self):
3722 log.debug("[control connection] Attempting to reconnect")
3723 try:
3724 self._set_new_connection(self._reconnect_internal())
3725 except NoHostAvailable:
3726 # make a retry schedule (which includes backoff)
3727 schedule = self._cluster.reconnection_policy.new_schedule()
3728
3729 with self._reconnection_lock:
3730
3731 # cancel existing reconnection attempts
3732 if self._reconnection_handler:
3733 self._reconnection_handler.cancel()
3734
3735 # when a connection is successfully made, _set_new_connection
3736 # will be called with the new connection and then our
3737 # _reconnection_handler will be cleared out
3738 self._reconnection_handler = _ControlReconnectionHandler(
3739 self, self._cluster.scheduler, schedule,
3740 self._get_and_set_reconnection_handler,
3741 new_handler=None)
3742 self._reconnection_handler.start()
3743 except Exception:
3744 log.debug("[control connection] error reconnecting", exc_info=True)
3745 raise
3746
3747 def _get_and_set_reconnection_handler(self, new_handler):
3748 """

Callers 1

Calls 6

_set_new_connectionMethod · 0.95
_reconnect_internalMethod · 0.95
new_scheduleMethod · 0.45
cancelMethod · 0.45
startMethod · 0.45

Tested by 1