Commit 465dcdec authored by Yoshinori Okuji's avatar Yoshinori Okuji

Handle ConflictError explicitly in tic. Make sure that active_threads is...

Handle ConflictError explicitly in tic. Make sure that active_threads is decremented before exiting from tic.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3546 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent aecf72ee
...@@ -41,6 +41,7 @@ from ActivityBuffer import ActivityBuffer ...@@ -41,6 +41,7 @@ from ActivityBuffer import ActivityBuffer
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
import threading import threading
import sys import sys
from ZODB.POSException import ConflictError
from zLOG import LOG from zLOG import LOG
...@@ -261,10 +262,13 @@ class ActivityTool (Folder, UniqueObject): ...@@ -261,10 +262,13 @@ class ActivityTool (Folder, UniqueObject):
active_threads += 1 active_threads += 1
tic_lock.release() tic_lock.release()
try:
# Wakeup each queue # Wakeup each queue
for activity in activity_list: for activity in activity_list:
try: try:
activity.wakeup(self, processing_node) activity.wakeup(self, processing_node)
except ConflictError:
raise
except: except:
LOG('CMFActivity:', 100, 'Core call to wakeup failed for activity %s' % activity) LOG('CMFActivity:', 100, 'Core call to wakeup failed for activity %s' % activity)
...@@ -276,9 +280,11 @@ class ActivityTool (Folder, UniqueObject): ...@@ -276,9 +280,11 @@ class ActivityTool (Folder, UniqueObject):
try: try:
activity.tic(self, processing_node) # Transaction processing is the responsability of the activity activity.tic(self, processing_node) # Transaction processing is the responsability of the activity
has_awake_activity = has_awake_activity or activity.isAwake(self, processing_node) has_awake_activity = has_awake_activity or activity.isAwake(self, processing_node)
except ConflictError:
raise
except: except:
LOG('CMFActivity:', 100, 'Core call to tic or isAwake failed for activity %s' % activity, error=sys.exc_info()) LOG('CMFActivity:', 100, 'Core call to tic or isAwake failed for activity %s' % activity, error=sys.exc_info())
finally:
# decrease the number of active_threads # decrease the number of active_threads
tic_lock.acquire() tic_lock.acquire()
active_threads -= 1 active_threads -= 1
......
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