[Erp5-report] r34890 nicolas - /erp5/trunk/products/ERP5Type/patches/memcache_client.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Apr 30 13:31:14 CEST 2010


Author: nicolas
Date: Fri Apr 30 13:31:10 2010
New Revision: 34890

URL: http://svn.erp5.org?rev=34890&view=rev
Log:
* Increase timeout of socket to 10s
* Apply a patch (known by python-memcached bug-tracker) to always return string.

Modified:
    erp5/trunk/products/ERP5Type/patches/memcache_client.py

Modified: erp5/trunk/products/ERP5Type/patches/memcache_client.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/memcache_client.py?rev=34890&r1=34889&r2=34890&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/memcache_client.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/memcache_client.py [utf8] Fri Apr 30 13:31:10 2010
@@ -147,5 +147,24 @@
   Client._val_to_store_info = Client__val_to_store_info
   memcache.check_key = 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]




More information about the Erp5-report mailing list