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

Method on_down

cassandra/cluster.py:1939–1975  ·  view source on GitHub ↗

Intended for internal use only.

(self, host, is_host_addition, expect_host_to_be_down=False)

Source from the content-addressed store, hash-verified

1937
1938 @run_in_executor
1939 def on_down(self, host, is_host_addition, expect_host_to_be_down=False):
1940 """
1941 Intended for internal use only.
1942 """
1943 if self.is_shutdown:
1944 return
1945
1946 with host.lock:
1947 was_up = host.is_up
1948
1949 # ignore down signals if we have open pools to the host
1950 # this is to avoid closing pools when a control connection host became isolated
1951 if self._discount_down_events and self.profile_manager.distance(host) != HostDistance.IGNORED:
1952 connected = False
1953 for session in tuple(self.sessions):
1954 pool_states = session.get_pool_state()
1955 pool_state = pool_states.get(host)
1956 if pool_state:
1957 connected |= pool_state['open_count'] > 0
1958 if connected:
1959 return
1960
1961 host.set_down()
1962 if (not was_up and not expect_host_to_be_down) or host.is_currently_reconnecting():
1963 return
1964
1965 log.warning("Host %s has been marked down", host)
1966
1967 self.profile_manager.on_down(host)
1968 self.control_connection.on_down(host)
1969 for session in tuple(self.sessions):
1970 session.on_down(host)
1971
1972 for listener in self.listeners:
1973 listener.on_down(host)
1974
1975 self._start_reconnector(host, is_host_addition)
1976
1977 def on_add(self, host, refresh_nodes=True):
1978 if self.is_shutdown:

Callers 7

on_downMethod · 0.45
run_add_or_renew_poolMethod · 0.45
_update_location_infoMethod · 0.45
_handle_status_changeMethod · 0.45
return_connectionMethod · 0.45

Calls 6

_start_reconnectorMethod · 0.95
get_pool_stateMethod · 0.80
set_downMethod · 0.80
distanceMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected