Commit a1aee309 authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Kazuhiko Shiozaki

Products.CMFActivity: Inverse dequeueMessage return value

dequeueMessage used to return False when something was done, and True
otherwise. The only caller which uses that value then reverses it, causing
a double-negative which makes the code confusing to read.
Inverse the meaning of the return value, getting rid of this double-
negation.
parent 856418a1
...@@ -351,7 +351,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor): ...@@ -351,7 +351,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
# XXX: duplicate ActivityTool.tic, without locking as we are being # XXX: duplicate ActivityTool.tic, without locking as we are being
# multiple activity nodes in a single process. # multiple activity nodes in a single process.
for activity in ActivityTool.activity_dict.itervalues(): for activity in ActivityTool.activity_dict.itervalues():
while not activity.dequeueMessage(activity_tool, node_id, ()): while activity.dequeueMessage(activity_tool, node_id, ()):
pass pass
# Monkey-patch catalog to synchronise between main thread and the # Monkey-patch catalog to synchronise between main thread and the
# isolated transaction. # isolated transaction.
......
...@@ -1038,7 +1038,7 @@ CREATE TABLE %s ( ...@@ -1038,7 +1038,7 @@ CREATE TABLE %s (
self.finalizeMessageExecution(activity_tool, message_list, self.finalizeMessageExecution(activity_tool, message_list,
uid_to_duplicate_uid_list_dict) uid_to_duplicate_uid_list_dict)
transaction.commit() transaction.commit()
return not message_list return bool(message_list)
def deleteMessageList(self, db, uid_list): def deleteMessageList(self, db, uid_list):
db.query("DELETE FROM %s WHERE uid IN (%s)" % ( db.query("DELETE FROM %s WHERE uid IN (%s)" % (
......
...@@ -1387,7 +1387,7 @@ class ActivityTool (BaseTool): ...@@ -1387,7 +1387,7 @@ class ActivityTool (BaseTool):
activity_list.sort(key=sort_key) # stable sort activity_list.sort(key=sort_key) # stable sort
for i, activity in enumerate(activity_list): for i, activity in enumerate(activity_list):
# Transaction processing is the responsability of the activity # Transaction processing is the responsability of the activity
if not activity.dequeueMessage(inner_self, processing_node, if activity.dequeueMessage(inner_self, processing_node,
node_family_id_set): node_family_id_set):
activity_list.append(activity_list.pop(i)) activity_list.append(activity_list.pop(i))
break break
......
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