[Erp5-report] r39553 kazuhiko - /erp5/trunk/products/ERP5Type/Tool/MemcachedTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 27 10:30:36 CEST 2010


Author: kazuhiko
Date: Wed Oct 27 10:30:35 2010
New Revision: 39553

URL: http://svn.erp5.org?rev=39553&view=rev
Log:
workaround for possible too many open memcached connections problem.

in _initialiseConnection(), try to disconnect existing connections if exist.

python-memcached's get() returns None in case of any error, but it also returns None if None is set, of course. so if 'reconnect' is unfortunately triggered by None value, we should have a living connection at that time.

to fix this issue perfectly, we should rewrite memcached client library that raises an Exception in case of exception.

Modified:
    erp5/trunk/products/ERP5Type/Tool/MemcachedTool.py

Modified: erp5/trunk/products/ERP5Type/Tool/MemcachedTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Tool/MemcachedTool.py?rev=39553&r1=39552&r2=39553&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Tool/MemcachedTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Tool/MemcachedTool.py [utf8] Wed Oct 27 10:30:35 2010
@@ -101,6 +101,10 @@ if memcache is not None:
       self._initialiseConnection()
 
     def _initialiseConnection(self):
+      try:
+        self.memcached_connection.disconnect_all()
+      except AttributeError:
+        pass
       init_dict = {}
       if self.server_max_key_length is not MARKER:
         init_dict['server_max_key_length'] = self.server_max_key_length




More information about the Erp5-report mailing list