Commit 741020f3 authored by Nicolas Delaby's avatar Nicolas Delaby

* Increase timeout of socket to 10s

* Apply a patch (known by python-memcached bug-tracker) to always return string.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34890 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent df075cf0
...@@ -147,5 +147,24 @@ if memcache is not None and memcache.__version__ < '1.45': ...@@ -147,5 +147,24 @@ if memcache is not None and memcache.__version__ < '1.45':
Client._val_to_store_info = Client__val_to_store_info Client._val_to_store_info = Client__val_to_store_info
memcache.check_key = memcache_check_key memcache.check_key = memcache_check_key
del Client__init__, Client__val_to_store_info, memcache_check_key del Client__init__, Client__val_to_store_info, memcache_check_key
_Host = memcache._Host
_Host._SOCKET_TIMEOUT = 10 if memcache is not None:
memcache._Host._SOCKET_TIMEOUT = 10 # wait more than 3s is safe
# always return string
# https://bugs.launchpad.net/python-memcached/+bug/509712
def readline(self):
buf = self.buffer
recv = self.socket.recv
while True:
index = buf.find('\r\n')
if index >= 0:
break
data = recv(4096)
if not data:
self.mark_dead('Connection closed while reading from %s'
% repr(self))
self.buffer = ''
return '' #None
buf += data
self.buffer = buf[index+2:]
return buf[:index]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment