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

Method _set_final_result

cassandra/cluster.py:4893–4913  ·  view source on GitHub ↗
(self, response)

Source from the content-addressed store, hash-verified

4891 "statement on host %s: %s" % (host, response)))
4892
4893 def _set_final_result(self, response):
4894 self._cancel_timer()
4895 if self._metrics is not None:
4896 self._metrics.request_timer.addValue(time.time() - self._start_time)
4897
4898 with self._callback_lock:
4899 self._final_result = response
4900 # save off current callbacks inside lock for execution outside it
4901 # -- prevents case where _final_result is set, then a callback is
4902 # added and executed on the spot, then executed again as a
4903 # registered callback
4904 to_call = tuple(
4905 partial(fn, response, *args, **kwargs)
4906 for (fn, args, kwargs) in self._callbacks
4907 )
4908
4909 self._event.set()
4910
4911 # apply each callback
4912 for callback_partial in to_call:
4913 callback_partial()
4914
4915 def _set_final_exception(self, response):
4916 self._cancel_timer()

Calls 2

_cancel_timerMethod · 0.95
timeMethod · 0.45

Tested by

no test coverage detected