Commit 03a84340 authored by Hardik Juneja's avatar Hardik Juneja

CMFActivity: Make ValidationErrorDelay overridable and change getResult to getResultDict

parent 670ea4e6
......@@ -146,21 +146,23 @@ class ActiveProcess(Base):
except AttributeError:
# BBB: self was created before implementation of __init__
return []
if type(result_list) is not ConflictFreeLog: # BBB: result_list is IOBTree
if type(result_list) is not ConflictFreeLog:
# BBB: result_list is IOBTree or LOBTree
return result_list.values()
return list(result_list)
security.declareProtected(CMFCorePermissions.ManagePortal, 'getResultDict')
def getResultDict(self, **kw):
"""
Returns the result with requested key else None
Returns the result Dict
"""
try:
result_list = self.result_list
result = result_list[key]
except KeyError:
return None
return result
result_dict = self.result_dict
if type(result_dict) is not ConflictFreeLog:
return result_dict
return {}
except AttributeError:
return {}
security.declareProtected(CMFCorePermissions.ManagePortal, 'activateResult')
def activateResult(self, result):
......
......@@ -43,7 +43,7 @@ INVALID_ORDER = 2
# Time global parameters
MAX_PROCESSING_TIME = 900 # in seconds
VALIDATION_ERROR_DELAY = 1 # in seconds
VALIDATION_ERROR_DELAY = 15 # in seconds
class Queue(object):
"""
......
......@@ -571,6 +571,7 @@ class SQLBase(Queue):
make_available_uid_list = []
notify_user_list = []
executed_uid_list = deletable_uid_list
if uid_to_duplicate_uid_list_dict is not None:
for m in message_list:
if m.getExecutionState() == MESSAGE_NOT_EXECUTED:
......
......@@ -31,7 +31,6 @@ from functools import total_ordering
from zLOG import LOG, TRACE, INFO, WARNING, ERROR, PANIC
from SQLBase import SQLBase, sort_message_key
from Products.CMFActivity.ActivityTool import Message
from Queue import Queue, VALIDATION_ERROR_DELAY, VALID, INVALID_PATH
# Stop validating more messages when this limit is reached
MAX_VALIDATED_LIMIT = 1000
......
......@@ -63,9 +63,10 @@ if ENABLE_JOBLIB:
self.callback = callback
def get(self, timeout=None):
if self.active_process.getResult(self.active_process_sig) is None:
resultDict = self.active_process.getResultDict()
if not resultDict.has_key(self.active_process_sig):
raise ConflictError
result = self.active_process.getResult(self.active_process_sig).result
result = resultDict[self.active_process_sig].result
if isinstance(result, Exception):
raise result
......@@ -96,7 +97,8 @@ if ENABLE_JOBLIB:
# create a signature and convert it to integer
sig = joblib_hash(batch.items[0])
sigint = int(sig, 16) % (10 ** 16)
if not self.active_process.getResult(sigint):
resultDict = self.active_process.getResultDict()
if not resultDict.has_key(sigint):
joblib_result = portal_activities.activate(activity='SQLJoblib',
tag="joblib_%s" % active_process_id,
signature=sig,
......
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