cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mish...@apache.org
Subject [1/3] git commit: Configurable client timeout for cqlsh.
Date Sat, 12 Jul 2014 03:21:36 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 d979ba272 -> 37abae6c3
  refs/heads/trunk 33060c66d -> c61a7e470


Configurable client timeout for cqlsh.

patch by Ryan McGuire; reviewed by Mikhail Stepura for CASSANDRA-7516


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/37abae6c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/37abae6c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/37abae6c

Branch: refs/heads/cassandra-2.1
Commit: 37abae6c32b0e81ce4889b1c8714e9c479b52e85
Parents: d979ba2
Author: Ryan McGuire <ryan@datastax.com>
Authored: Sat Jul 12 14:17:48 2014 +1100
Committer: Mikhail Stepura <mishail@apache.org>
Committed: Sat Jul 12 14:20:49 2014 +1100

----------------------------------------------------------------------
 CHANGES.txt |  1 +
 bin/cqlsh   | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/37abae6c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ce885eb..27c28ae 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,7 @@
  * Fix NPE when unknown prepared statement ID is used (CASSANDRA-7454)
  * Adjust MT depth based on # of partition validating (CASSANDRA-5263)
  * Optimise NativeCell comparisons (CASSANDRA-6755)
+ * Configurable client timeout for cqlsh (CASSANDRA-7516)
 
 
 2.1.0-final

http://git-wip-us.apache.org/repos/asf/cassandra/blob/37abae6c/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index c3a4ea6..9a6d536 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -467,7 +467,8 @@ class Shell(cmd.Cmd):
                  display_time_format=DEFAULT_TIME_FORMAT,
                  display_float_precision=DEFAULT_FLOAT_PRECISION,
                  ssl=False,
-                 single_statement=None):
+                 single_statement=None,
+                 client_timeout=10):
         cmd.Cmd.__init__(self, completekey=completekey)
         self.hostname = hostname
         self.port = port
@@ -493,6 +494,7 @@ class Shell(cmd.Cmd):
             self.session = self.conn.connect(keyspace)
         else:
             self.session = self.conn.connect()
+        self.session.default_timeout = client_timeout
         self.get_connection_versions()
 
         self.current_keyspace = keyspace
@@ -1778,6 +1780,11 @@ def read_options(cmdlineargs, environment):
 
     hostname = option_with_default(configs.get, 'connection', 'hostname', DEFAULT_HOST)
     port = option_with_default(configs.get, 'connection', 'port', DEFAULT_PORT)
+    options.client_timeout = option_with_default(configs.get, 'connection', 'client_timeout',
'10')
+    if options.client_timeout.lower() == 'none':
+        options.client_timeout = None
+    else:
+        options.client_timeout = int(options.client_timeout)
 
     hostname = environment.get('CQLSH_HOST', hostname)
     port = environment.get('CQLSH_PORT', port)
@@ -1874,7 +1881,8 @@ def main(options, hostname, port):
                       display_time_format=options.time_format,
                       display_float_precision=options.float_precision,
                       ssl=options.ssl,
-                      single_statement=options.execute)
+                      single_statement=options.execute,
+                      client_timeout=options.client_timeout)
     except KeyboardInterrupt:
         sys.exit('Connection aborted.')
     except CQL_ERRORS, e:


Mime
View raw message