Commit 283b08de authored by Julien Muchembled's avatar Julien Muchembled

CMFActivity: fix notification of failing messages with infinite retry

parent 32bd1215
...@@ -36,7 +36,7 @@ from Products.CMFActivity.ActivityTool import ( ...@@ -36,7 +36,7 @@ from Products.CMFActivity.ActivityTool import (
Message, MESSAGE_NOT_EXECUTED, MESSAGE_EXECUTED) Message, MESSAGE_NOT_EXECUTED, MESSAGE_EXECUTED)
from Products.CMFActivity.ActiveObject import INVOKE_ERROR_STATE from Products.CMFActivity.ActiveObject import INVOKE_ERROR_STATE
from Products.CMFActivity.ActivityRuntimeEnvironment import ( from Products.CMFActivity.ActivityRuntimeEnvironment import (
ActivityRuntimeEnvironment, getTransactionalVariable) DEFAULT_MAX_RETRY, ActivityRuntimeEnvironment, getTransactionalVariable)
from Queue import Queue, VALIDATION_ERROR_DELAY, VALID, INVALID_PATH from Queue import Queue, VALIDATION_ERROR_DELAY, VALID, INVALID_PATH
from Products.CMFActivity.Errors import ActivityFlushError from Products.CMFActivity.Errors import ActivityFlushError
...@@ -460,7 +460,7 @@ class SQLBase(Queue): ...@@ -460,7 +460,7 @@ class SQLBase(Queue):
continue continue
# In case of infinite retry, notify the user # In case of infinite retry, notify the user
# when the default limit is reached. # when the default limit is reached.
if max_retry is None and retry == m.__class__.max_retry: if max_retry is None and retry == DEFAULT_MAX_RETRY:
notify_user_list.append((m, True)) notify_user_list.append((m, True))
delay = m.delay delay = m.delay
if delay is None: if delay is None:
......
...@@ -2,6 +2,8 @@ from Products.ERP5Type.TransactionalVariable import getTransactionalVariable ...@@ -2,6 +2,8 @@ from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
DEFAULT_MAX_RETRY = 3
def getActivityRuntimeEnvironment(): def getActivityRuntimeEnvironment():
""" """
Raises KeyError if called outside activity. Raises KeyError if called outside activity.
...@@ -23,7 +25,7 @@ class BaseMessage: ...@@ -23,7 +25,7 @@ class BaseMessage:
delay = __property(delay=None) delay = __property(delay=None)
# None means infinite retry # None means infinite retry
max_retry = __property(max_retry=3) max_retry = __property(max_retry=DEFAULT_MAX_RETRY)
# For errors happening after message invocation (ConflictError), # For errors happening after message invocation (ConflictError),
# should we retry quickly without increasing 'retry' count ? # should we retry quickly without increasing 'retry' count ?
conflict_retry = __property(conflict_retry=True) conflict_retry = __property(conflict_retry=True)
......
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