MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / _start_reconnector

Method _start_reconnector

cassandra/cluster.py:1914–1936  ·  view source on GitHub ↗
(self, host, is_host_addition)

Source from the content-addressed store, hash-verified

1912 return futures
1913
1914 def _start_reconnector(self, host, is_host_addition):
1915 if self.profile_manager.distance(host) == HostDistance.IGNORED:
1916 return
1917
1918 schedule = self.reconnection_policy.new_schedule()
1919
1920 # in order to not hold references to this Cluster open and prevent
1921 # proper shutdown when the program ends, we'll just make a closure
1922 # of the current Cluster attributes to create new Connections with
1923 conn_factory = self._make_connection_factory(host)
1924
1925 reconnector = _HostReconnectionHandler(
1926 host, conn_factory, is_host_addition, self.on_add, self.on_up,
1927 self.scheduler, schedule, host.get_and_set_reconnection_handler,
1928 new_handler=None)
1929
1930 old_reconnector = host.get_and_set_reconnection_handler(reconnector)
1931 if old_reconnector:
1932 log.debug("Old host reconnector found for %s, cancelling", host)
1933 old_reconnector.cancel()
1934
1935 log.debug("Starting reconnector for host %s", host)
1936 reconnector.start()
1937
1938 @run_in_executor
1939 def on_down(self, host, is_host_addition, expect_host_to_be_down=False):

Callers 2

on_downMethod · 0.95

Calls 7

distanceMethod · 0.45
new_scheduleMethod · 0.45
cancelMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected