Commit 98bd9dd7 authored by Sebastien Robin's avatar Sebastien Robin

message with errors are not deleted with ramqueue


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@746 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e3d61ebe
...@@ -62,8 +62,6 @@ class RAMQueue(Queue): ...@@ -62,8 +62,6 @@ class RAMQueue(Queue):
i = i + 1 i = i + 1
def dequeueMessage(self, activity_tool, processing_node): def dequeueMessage(self, activity_tool, processing_node):
if len(self.getQueue(activity_tool)) is 0:
return 1 # Go to sleep
for m in self.getQueue(activity_tool): for m in self.getQueue(activity_tool):
if not m.validate(self, activity_tool): if not m.validate(self, activity_tool):
self.deleteMessage(activity_tool, m) # Trash messages which are not validated (no error handling) self.deleteMessage(activity_tool, m) # Trash messages which are not validated (no error handling)
...@@ -76,7 +74,9 @@ class RAMQueue(Queue): ...@@ -76,7 +74,9 @@ class RAMQueue(Queue):
return 0 # Keep on ticking return 0 # Keep on ticking
else: else:
# Start a new transaction and keep on to next message # Start a new transaction and keep on to next message
get_transaction().commit() get_transaction().commit()
return 1 # Go to sleep
def hasActivity(self, activity_tool, object, **kw): def hasActivity(self, activity_tool, object, **kw):
object_path = object.getPhysicalPath() object_path = object.getPhysicalPath()
...@@ -102,14 +102,14 @@ class RAMQueue(Queue): ...@@ -102,14 +102,14 @@ class RAMQueue(Queue):
for m in self.getQueue(activity_tool): for m in self.getQueue(activity_tool):
if object_path == m.object_path and (method_id is None or method_id == m.method_id): if object_path == m.object_path and (method_id is None or method_id == m.method_id):
if not m.validate(self, activity_tool): if not m.validate(self, activity_tool):
activity_tool.deleteMessage(self, m) # Trash messages which are not validated (no error handling) self.deleteMessage(activity_tool, m) # Trash messages which are not validated (no error handling)
else: else:
if invoke: if invoke:
activity_tool.invoke(m) activity_tool.invoke(m)
if m.is_executed: if m.is_executed:
activity_tool.deleteMessage(self, m) # Only delete if no error happens self.deleteMessage(activity_tool, m) # Only delete if no error happens
else: else:
activity_tool.deleteMessage(self, m) self.deleteMessage(activity_tool, m)
def getMessageList(self, activity_tool, processing_node=None): def getMessageList(self, activity_tool, processing_node=None):
new_queue = [] new_queue = []
......
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