Commit 373c83a8 authored by Vincent Pelletier's avatar Vincent Pelletier

Compute maximum processing timestamp once.

Use timestamp instead of DateTime.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17491 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fabbe1b5
...@@ -36,6 +36,7 @@ from Products.CMFActivity.Errors import ActivityFlushError ...@@ -36,6 +36,7 @@ from Products.CMFActivity.Errors import ActivityFlushError
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from types import ClassType from types import ClassType
import sys import sys
from time import time
try: try:
from transaction import get as get_transaction from transaction import get as get_transaction
...@@ -84,14 +85,15 @@ class SQLQueue(RAMQueue): ...@@ -84,14 +85,15 @@ class SQLQueue(RAMQueue):
if readMessage is None: if readMessage is None:
return 1 return 1
# XXX: arbitrary maximum delay.
# Stop processing new messages if processing duration exceeds 10 seconds.
activity_stop_time = time() + 10
now_date = DateTime() now_date = DateTime()
# Next processing date in case of error # Next processing date in case of error
next_processing_date = now_date + float(VALIDATION_ERROR_DELAY)/86400 next_processing_date = now_date + float(VALIDATION_ERROR_DELAY)/86400
message_list = readMessage(processing_node=processing_node, to_date=now_date) message_list = readMessage(processing_node=processing_node, to_date=now_date)
for line in message_list: for line in message_list:
# Do not process many messages if there are long if time() > activity_stop_time:
new_date = DateTime()
if ((new_date-now_date)*86400) > 10:
break break
path = line.path path = line.path
method_id = line.method_id method_id = line.method_id
......
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