Commit 556a41d9 authored by Julien Muchembled's avatar Julien Muchembled

minor refactoring

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34840 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d74dc371
......@@ -498,10 +498,13 @@ class SQLDict(RAMDict, SQLBase):
readMessageList = getattr(activity_tool, 'SQLDict_readMessageList', None)
if readMessageList is not None:
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:
while 1:
result = readMessageList(path=None, method_id=None, processing_node=-1,
to_date=now_date, include_processing=0,
offset=offset, count=READ_MESSAGE_LIMIT)
if not result:
return
get_transaction().commit()
validation_text_dict = {'none': 1}
......@@ -562,10 +565,9 @@ class SQLDict(RAMDict, SQLBase):
activity_tool.SQLBase_assignMessage(table=self.sql_table,
processing_node=0, uid=tuple(distributable_uid_set))
validated_count += distributable_count
if validated_count < MAX_VALIDATED_LIMIT:
offset += READ_MESSAGE_LIMIT
result = readMessageList(path=None, method_id=None, processing_node=-1,
to_date=now_date, include_processing=0, offset=offset, count=READ_MESSAGE_LIMIT)
if validated_count >= MAX_VALIDATED_LIMIT:
return
offset += READ_MESSAGE_LIMIT
# Validation private methods
def _validate(self, activity_tool, method_id=None, message_uid=None, path=None, tag=None,
......
......@@ -390,17 +390,19 @@ class SQLQueue(RAMQueue, SQLBase):
readMessageList = getattr(activity_tool, 'SQLQueue_readMessageList', None)
if readMessageList is not None:
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:
while 1:
result = readMessageList(path=None, method_id=None, processing_node=-1,
to_date=now_date, include_processing=0,
offset=offset, count=READ_MESSAGE_LIMIT)
if not result:
return
get_transaction().commit()
validation_text_dict = {'none': 1}
message_dict = {}
for line in result:
message = self.loadMessage(line.message, uid = line.uid)
message = self.loadMessage(line.message, uid=line.uid, line=line)
message.order_validation_text = self.getOrderValidationText(message)
self.getExecutableMessageList(activity_tool, message, message_dict,
validation_text_dict, now_date=now_date)
......@@ -409,11 +411,9 @@ class SQLQueue(RAMQueue, SQLBase):
activity_tool.SQLBase_assignMessage(table=self.sql_table,
processing_node=0, uid=[m.uid for m in message_dict.itervalues()])
validated_count += distributable_count
if validated_count < MAX_VALIDATED_LIMIT:
offset += READ_MESSAGE_LIMIT
result = readMessageList(path=None, method_id=None, processing_node=-1,
to_date=now_date, include_processing=0,
offset=offset, count=READ_MESSAGE_LIMIT)
if validated_count >= MAX_VALIDATED_LIMIT:
return
offset += READ_MESSAGE_LIMIT
# Validation private methods
def _validate(self, activity_tool, method_id=None, message_uid=None, path=None, tag=None,
......
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