You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2018/05/07 23:11:40 UTC
[thrift] branch master updated: THRIFT-4561: Remove python socket
timeout
This is an automated email from the ASF dual-hosted git repository.
jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new edf8f0f THRIFT-4561: Remove python socket timeout
edf8f0f is described below
commit edf8f0f2511e8eed3bb2129413307665ef4f4b79
Author: Josip Sokcevic <js...@thumbtack.com>
AuthorDate: Thu Apr 26 19:30:25 2018 -0700
THRIFT-4561: Remove python socket timeout
Timeout is already set in HttpClient. The reason for removal is issue
with gunicorn and gevent as described here
https://github.com/benoitc/gunicorn/pull/1616
---
lib/py/src/transport/THttpClient.py | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/lib/py/src/transport/THttpClient.py b/lib/py/src/transport/THttpClient.py
index 60ff226..37b0a4d 100644
--- a/lib/py/src/transport/THttpClient.py
+++ b/lib/py/src/transport/THttpClient.py
@@ -19,7 +19,6 @@
from io import BytesIO
import os
-import socket
import ssl
import sys
import warnings
@@ -128,9 +127,6 @@ class THttpClient(TTransportBase):
return self.__http is not None
def setTimeout(self, ms):
- if not hasattr(socket, 'getdefaulttimeout'):
- raise NotImplementedError
-
if ms is None:
self.__timeout = None
else:
@@ -145,17 +141,6 @@ class THttpClient(TTransportBase):
def write(self, buf):
self.__wbuf.write(buf)
- def __withTimeout(f):
- def _f(*args, **kwargs):
- orig_timeout = socket.getdefaulttimeout()
- socket.setdefaulttimeout(args[0].__timeout)
- try:
- result = f(*args, **kwargs)
- finally:
- socket.setdefaulttimeout(orig_timeout)
- return result
- return _f
-
def flush(self):
if self.isOpen():
self.close()
@@ -200,7 +185,3 @@ class THttpClient(TTransportBase):
self.code = self.__http_response.status
self.message = self.__http_response.reason
self.headers = self.__http_response.msg
-
- # Decorate if we know how to timeout
- if hasattr(socket, 'getdefaulttimeout'):
- flush = __withTimeout(flush)
--
To stop receiving notification emails like this one, please contact
jking@apache.org.