Commit a2ec6d29 authored by Yusei Tahara's avatar Yusei Tahara

Use generateMessageUID instead.

Update and add comments to distribute method definition.
Remove a new line mistakenly added.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28737 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 40d9378a
...@@ -612,7 +612,6 @@ class SQLDict(RAMDict, SQLBase): ...@@ -612,7 +612,6 @@ class SQLDict(RAMDict, SQLBase):
now_date = self.getNow(activity_tool) now_date = self.getNow(activity_tool)
result = readMessageList(path=None, method_id=None, processing_node=-1, result = readMessageList(path=None, method_id=None, processing_node=-1,
to_date=now_date, include_processing=0, offset=offset, count=READ_MESSAGE_LIMIT) to_date=now_date, include_processing=0, offset=offset, count=READ_MESSAGE_LIMIT)
validated_count = 0 validated_count = 0
while len(result) and validated_count < MAX_VALIDATED_LIMIT: while len(result) and validated_count < MAX_VALIDATED_LIMIT:
get_transaction().commit() get_transaction().commit()
...@@ -632,21 +631,20 @@ class SQLDict(RAMDict, SQLBase): ...@@ -632,21 +631,20 @@ class SQLDict(RAMDict, SQLBase):
# SQLDict considers object_path, method_id, tag to unify activities, # SQLDict considers object_path, method_id, tag to unify activities,
# but ignores method arguments. They are outside of semantics. # but ignores method arguments. They are outside of semantics.
for key in message_dict.keys(): for key in message_dict.keys():
# we manipulate message_dict below so that we cannot use
# iterator here.
message = message_dict[key] message = message_dict[key]
unique_key = (tuple(message.object_path), message.method_id, unique_key = self.generateMessageUID(message)
message.activity_kw.get('tag'),
message.activity_kw.get('group_id'),
)
if unique_key in message_unique_set: if unique_key in message_unique_set:
deletable_uid_list.append(message.uid) deletable_uid_list.append(message.uid)
del message_dict[message.uid] del message_dict[message.uid]
else: else:
message_unique_set.add(unique_key) message_unique_set.add(unique_key)
# don't let through if there is the same serialization tag in the # 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 # message dict. If there is the same serialization tag, only one can
# be validated and others must wait. # be validated and others must wait.
# but messages with group_method_id are exceptions. serialization_tag # But messages with group_method_id are exceptions. serialization_tag
# does not stop simultaneous validation. because such messages will # does not stop validating together. Because those messages should
# be processed together at once. # be processed together at once.
serialization_tag_set = set() serialization_tag_set = set()
serialization_tag_group_method_id_dict = {} serialization_tag_group_method_id_dict = {}
...@@ -658,6 +656,7 @@ class SQLDict(RAMDict, SQLBase): ...@@ -658,6 +656,7 @@ class SQLDict(RAMDict, SQLBase):
if serialization_tag is not None: if serialization_tag is not None:
if serialization_tag in serialization_tag_set: if serialization_tag in serialization_tag_set:
if group_method_id is not None: 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: if serialization_tag_group_method_id_dict[serialization_tag]!=group_method_id:
del message_dict[message.uid] del message_dict[message.uid]
else: else:
......
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