raise if timeout during query plan

This commit is contained in:
Adam Holmberg
2016-04-14 11:58:09 -05:00
parent 2a507e7799
commit 023a7a876d

View File

@@ -2810,6 +2810,7 @@ class ResponseFuture(object):
""" Internal """
# query_plan is an iterator, so this will resume where we last left
# off if send_request() is called multiple times
start = time.time()
for host in self.query_plan:
req_id = self._query(host)
if req_id is not None:
@@ -2821,6 +2822,9 @@ class ResponseFuture(object):
if self._timer is None:
self._start_timer()
return
if self.timeout is not None and time.time() - start > self.timeout:
self._on_timeout()
return
self._set_final_exception(NoHostAvailable(
"Unable to complete the operation against any hosts", self._errors))