Commit 030278df authored by Yoshinori Okuji's avatar Yoshinori Okuji

Add paranoid logging.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13673 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 273eeefc
...@@ -43,7 +43,7 @@ try: ...@@ -43,7 +43,7 @@ try:
except ImportError: except ImportError:
pass pass
from zLOG import LOG, TRACE, WARNING from zLOG import LOG, TRACE, WARNING, ERROR
MAX_PRIORITY = 5 MAX_PRIORITY = 5
MAX_GROUPED_OBJECTS = 500 MAX_GROUPED_OBJECTS = 500
...@@ -206,7 +206,7 @@ class SQLDict(RAMDict): ...@@ -206,7 +206,7 @@ class SQLDict(RAMDict):
# If the result is still empty, shift the dates so that SQLDict can dispatch pending active # If the result is still empty, shift the dates so that SQLDict can dispatch pending active
# objects quickly. # objects quickly.
self.timeShift(activity_tool, VALIDATION_ERROR_DELAY, processing_node,retry=1) self.timeShift(activity_tool, VALIDATION_ERROR_DELAY, processing_node,retry=1)
elif len(result) > 0: else:
#LOG('SQLDict dequeueMessage', 100, 'result = %r' % (list(result))) #LOG('SQLDict dequeueMessage', 100, 'result = %r' % (list(result)))
line = result[0] line = result[0]
path = line.path path = line.path
...@@ -321,6 +321,7 @@ class SQLDict(RAMDict): ...@@ -321,6 +321,7 @@ class SQLDict(RAMDict):
# Unfortunately, database adapters may raise an exception against abort. # Unfortunately, database adapters may raise an exception against abort.
LOG('SQLDict', WARNING, 'abort failed, thus some objects may be modified accidentally') LOG('SQLDict', WARNING, 'abort failed, thus some objects may be modified accidentally')
pass pass
try:
if isinstance(exc, ConflictError): if isinstance(exc, ConflictError):
# For a conflict error, simply delay the operations. # For a conflict error, simply delay the operations.
for uid_list in uid_list_list: for uid_list in uid_list_list:
...@@ -338,8 +339,17 @@ class SQLDict(RAMDict): ...@@ -338,8 +339,17 @@ class SQLDict(RAMDict):
'Error in ActivityTool.invoke', error=sys.exc_info()) 'Error in ActivityTool.invoke', error=sys.exc_info())
get_transaction().commit() get_transaction().commit()
except:
LOG('SQLDict', ERROR, 'SQLDict.dequeueMessage raised, and cannot even set processing to zero due to an exception',
error=sys.exc_info())
raise
return 0 return 0
except:
LOG('SQLDict', ERROR, 'SQLDict.dequeueMessage raised an exception which is not a subclass of Exception',
error=sys.exc_info())
raise
try:
for i in xrange(len(message_list)): for i in xrange(len(message_list)):
m = message_list[i] m = message_list[i]
uid_list = uid_list_list[i] uid_list = uid_list_list[i]
...@@ -372,6 +382,10 @@ class SQLDict(RAMDict): ...@@ -372,6 +382,10 @@ class SQLDict(RAMDict):
activity_tool.SQLDict_setPriority(uid = uid_list, delay = VALIDATION_ERROR_DELAY, activity_tool.SQLDict_setPriority(uid = uid_list, delay = VALIDATION_ERROR_DELAY,
priority = priority + 1, retry = 1) priority = priority + 1, retry = 1)
get_transaction().commit() # Release locks before starting a potentially long calculation get_transaction().commit() # Release locks before starting a potentially long calculation
except:
LOG('SQLDict', ERROR, 'SQLDict.dequeueMessage raised an exception during checking for the results of processed messages',
error=sys.exc_info())
raise
return 0 return 0
get_transaction().commit() # Release locks before starting a potentially long calculation get_transaction().commit() # Release locks before starting a potentially long calculation
......
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