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
from ZODB.POSException import ConflictError
from types import ClassType
import sys
from time import time
try:
from transaction import get as get_transaction
......@@ -84,14 +85,15 @@ class SQLQueue(RAMQueue):
if readMessage is None:
return 1
# XXX: arbitrary maximum delay.
# Stop processing new messages if processing duration exceeds 10 seconds.
activity_stop_time = time() + 10
now_date = DateTime()
# Next processing date in case of error
next_processing_date = now_date + float(VALIDATION_ERROR_DELAY)/86400
message_list = readMessage(processing_node=processing_node, to_date=now_date)
for line in message_list:
# Do not process many messages if there are long
new_date = DateTime()
if ((new_date-now_date)*86400) > 10:
if time() > activity_stop_time:
break
path = line.path
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