[Erp5-report] r28737 - /erp5/trunk/products/CMFActivity/Activity/SQLDict.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Sep 2 04:05:56 CEST 2009


Author: yusei
Date: Wed Sep  2 04:05:56 2009
New Revision: 28737

URL: http://svn.erp5.org?rev=28737&view=rev
Log:
Use generateMessageUID instead.
Update and add comments to distribute method definition.
Remove a new line mistakenly added.

Modified:
    erp5/trunk/products/CMFActivity/Activity/SQLDict.py

Modified: erp5/trunk/products/CMFActivity/Activity/SQLDict.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLDict.py?rev=28737&r1=28736&r2=28737&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLDict.py [utf8] (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLDict.py [utf8] Wed Sep  2 04:05:56 2009
@@ -612,7 +612,6 @@
       now_date = self.getNow(activity_tool)
       result = readMessageList(path=None, method_id=None, processing_node=-1,
                                to_date=now_date, include_processing=0, offset=offset, count=READ_MESSAGE_LIMIT)
-
       validated_count = 0
       while len(result) and validated_count < MAX_VALIDATED_LIMIT:
         get_transaction().commit()
@@ -632,21 +631,20 @@
           # SQLDict considers object_path, method_id, tag to unify activities,
           # but ignores method arguments. They are outside of semantics.
           for key in message_dict.keys():
+            # we manipulate message_dict below so that we cannot use
+            # iterator here.
             message = message_dict[key]
-            unique_key = (tuple(message.object_path), message.method_id,
-                          message.activity_kw.get('tag'),
-                          message.activity_kw.get('group_id'),
-                          )
+            unique_key = self.generateMessageUID(message)
             if unique_key in message_unique_set:
               deletable_uid_list.append(message.uid)
               del message_dict[message.uid]
             else:
               message_unique_set.add(unique_key)
-          # don't let through if there is the same serialization tag in the
-          # message dict. if there is the same serialization tag, only one can
+          # Don't let through if there is the same serialization tag in the
+          # message dict. If there is the same serialization tag, only one can
           # be validated and others must wait.
-          # but messages with group_method_id are exceptions. serialization_tag
-          # does not stop simultaneous validation. because such messages will
+          # But messages with group_method_id are exceptions. serialization_tag
+          # does not stop validating together. Because those messages should
           # be processed together at once.
           serialization_tag_set = set()
           serialization_tag_group_method_id_dict = {}
@@ -658,6 +656,7 @@
             if serialization_tag is not None:
               if serialization_tag in serialization_tag_set:
                 if group_method_id is not None:
+                  # Only one group_method_id can pass through.
                   if serialization_tag_group_method_id_dict[serialization_tag]!=group_method_id:
                     del message_dict[message.uid]
                 else:




More information about the Erp5-report mailing list