[Erp5-report] r17491 - /erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Nov 9 14:35:36 CET 2007
Author: vincent
Date: Fri Nov 9 14:35:36 2007
New Revision: 17491
URL: http://svn.erp5.org?rev=17491&view=rev
Log:
Compute maximum processing timestamp once.
Use timestamp instead of DateTime.
Modified:
erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
Modified: erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLQueue.py?rev=17491&r1=17490&r2=17491&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLQueue.py (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLQueue.py Fri Nov 9 14:35:36 2007
@@ -36,6 +36,7 @@
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 @@
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
More information about the Erp5-report
mailing list