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

Method _on_speculative_execute

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

Source from the content-addressed store, hash-verified

4498 self._set_final_exception(OperationTimedOut(errors, self._current_host))
4499
4500 def _on_speculative_execute(self):
4501 self._timer = None
4502 if not self._event.is_set():
4503
4504 # PYTHON-836, the speculative queries must be after
4505 # the query is sent from the main thread, otherwise the
4506 # query from the main thread may raise NoHostAvailable
4507 # if the _query_plan has been exhausted by the speculative queries.
4508 # This also prevents a race condition accessing the iterator.
4509 # We reschedule this call until the main thread has succeeded
4510 # making a query
4511 if not self.attempted_hosts:
4512 self._timer = self.session.cluster.connection_class.create_timer(0.01, self._on_speculative_execute)
4513 return
4514
4515 if self._time_remaining is not None:
4516 if self._time_remaining <= 0:
4517 self._on_timeout()
4518 return
4519 self.send_request(error_no_hosts=False)
4520 self._start_timer()
4521
4522 def _make_query_plan(self):
4523 # set the query_plan according to the load balancing policy,

Callers

nothing calls this directly

Calls 4

_on_timeoutMethod · 0.95
send_requestMethod · 0.95
_start_timerMethod · 0.95
create_timerMethod · 0.45

Tested by

no test coverage detected