From ed95537d029a574ba52143462ca6e917c9a25d20 Mon Sep 17 00:00:00 2001 From: Erik Cederstrand Date: Tue, 29 Nov 2016 15:34:48 +0100 Subject: Set socket timeout unconditionally on TSocket Since thriftpy 0.3.3, there has been a `socket_timeout` option to `TSocket`. The default is 3000 ms. Setting it to `None` means "never timeout". Remove the `if self.timeout is not None` conditional so a value of `None` can also be set explicitly from happybase. --- happybase/connection.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/happybase/connection.py b/happybase/connection.py index 36c6735..01ab83b 100644 --- a/happybase/connection.py +++ b/happybase/connection.py @@ -151,9 +151,7 @@ class Connection(object): def _refresh_thrift_client(self): """Refresh the Thrift socket, transport, and client.""" - socket = TSocket(self.host, self.port) - if self.timeout is not None: - socket.set_timeout(self.timeout) + socket = TSocket(host=self.host, port=self.port, socket_timeout=self.timeout) self.transport = self._transport_class(socket) protocol = self._protocol_class(self.transport, decode_response=False) -- cgit v1.2.1