From 023a7a876d5068744d3f26b0812d09ca9f626d35 Mon Sep 17 00:00:00 2001 From: Adam Holmberg Date: Thu, 14 Apr 2016 11:58:09 -0500 Subject: [PATCH] raise if timeout during query plan --- cassandra/cluster.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cassandra/cluster.py b/cassandra/cluster.py index a9dacff4..9f1ee60c 100644 --- a/cassandra/cluster.py +++ b/cassandra/cluster.py @@ -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))