diff --git a/product/CMFActivity/Activity/SQLDict.py b/product/CMFActivity/Activity/SQLDict.py index 7bb3aa7e615d1dfba8c0232347ed1e76b7ed09ca..b718d6509d0e8c285df989aa2a13961df28fe562 100755 --- a/product/CMFActivity/Activity/SQLDict.py +++ b/product/CMFActivity/Activity/SQLDict.py @@ -44,7 +44,7 @@ except ImportError: from zLOG import LOG MAX_PRIORITY = 5 -MAX_GROUPED_OBJECTS = 300 +MAX_GROUPED_OBJECTS = 500 priority_weight = \ [1] * 64 + \ @@ -106,7 +106,10 @@ class SQLDict(RAMDict): def prepareDeleteMessage(self, activity_tool, m): # Erase all messages in a single transaction path = '/'.join(m.object_path) - uid_list = activity_tool.SQLDict_readUidList(path=path, method_id=m.method_id,processing_node=None) + order_validation_text = self.getOrderValidationText(m) + uid_list = activity_tool.SQLDict_readUidList(path = path, method_id = m.method_id, + order_validation_text = order_validation_text, + processing_node = None) uid_list = [x.uid for x in uid_list] if len(uid_list)>0: activity_tool.SQLDict_delMessage(uid = uid_list) @@ -154,7 +157,12 @@ class SQLDict(RAMDict): if hasattr(self, method_id): order_validation_item_list.append((key, message.activity_kw[key])) if len(order_validation_item_list) == 0: - return '' + # When no order validation argument is specified, skip the computation + # of the checksum for speed. Here, 'none' is used, because this never be + # identical to SHA1 hexdigest (which is always 40 characters), and 'none' + # is true in Python. This is important, because dtml-if assumes that an empty + # string is false, so we must use a non-empty string for this. + return 'none' return sha.new(repr(order_validation_item_list)).hexdigest() def validateMessage(self, activity_tool, message, uid_list, priority, processing_node): @@ -208,7 +216,10 @@ class SQLDict(RAMDict): line = result[0] path = line.path method_id = line.method_id - uid_list = activity_tool.SQLDict_readUidList( path=path, method_id=method_id, processing_node=None, to_date=now_date ) + order_validation_text = line.order_validation_text + uid_list = activity_tool.SQLDict_readUidList(path = path, method_id = method_id, + processing_node = None, to_date = now_date, + order_validation_text = order_validation_text) uid_list = [x.uid for x in uid_list] uid_list_list = [uid_list] priority_list = [line.priority] @@ -241,13 +252,16 @@ class SQLDict(RAMDict): if count < MAX_GROUPED_OBJECTS: # Retrieve objects which have the same group method. - result = activity_tool.SQLDict_readMessage(processing_node=processing_node, priority=priority, - to_date=now_date, group_method_id=group_method_id) + result = activity_tool.SQLDict_readMessage(processing_node = processing_node, priority = priority, + to_date = now_date, group_method_id = group_method_id, + order_validation_text = order_validation_text) #LOG('SQLDict dequeueMessage', 0, 'result = %d' % (len(result))) for line in result: path = line.path method_id = line.method_id - uid_list = activity_tool.SQLDict_readUidList( path=path, method_id=method_id, processing_node=None, to_date=now_date ) + uid_list = activity_tool.SQLDict_readUidList(path = path, method_id = method_id, + processing_node = None, to_date = now_date, + order_validation_text = order_validation_text) uid_list = [x.uid for x in uid_list] if len(uid_list) > 0: # Set selected messages to processing diff --git a/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql index 0418f11ddb72a6315c29e1e00ca36739e1eacd77..79f5a52c4aab394f4e56c71bd7d21f04426d9a27 100755 --- a/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql @@ -11,7 +11,8 @@ class_file: priority to_date to_processing_date -group_method_id</params> +group_method_id +order_validation_text</params> SELECT DISTINCT * FROM message WHERE @@ -20,6 +21,7 @@ WHERE <dtml-if priority> AND priority = <dtml-sqlvar priority type="int"> </dtml-if> <dtml-if to_date>AND date <= <dtml-sqlvar to_date type="datetime"> </dtml-if> <dtml-if group_method_id>AND group_method_id = <dtml-sqlvar group_method_id type="string"> </dtml-if> +<dtml-if order_validation_text>AND order_validation_text = <dtml-sqlvar order_validation_text type="string"> </dtml-if> GROUP BY path, method_id diff --git a/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql b/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql index 8614d9b93432fcec3794de5213c56f88d5a1d2b4..cfebb616bf5876e548a7d11d850bfdf3b083d2ac 100755 --- a/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql +++ b/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql @@ -10,7 +10,8 @@ class_file: <params>processing_node method_id path -to_date</params> +to_date +order_validation_text</params> SELECT uid FROM message WHERE @@ -19,3 +20,4 @@ WHERE <dtml-if method_id> AND method_id = <dtml-sqlvar method_id type="string"> </dtml-if> <dtml-if path> AND path = <dtml-sqlvar path type="string"> </dtml-if> <dtml-if to_date> AND date <= <dtml-sqlvar to_date type="datetime"> </dtml-if> +<dtml-if order_validation_text> AND order_validation_text = <dtml-sqlvar order_validation_text type="string"> </dtml-if>