Commit f506c769 authored by Alexandre Boeglin's avatar Alexandre Boeglin

When calling tic() for the first time on a node, we want to clear the

processing flag for all activities processed by this node, to clear zombie
activities safely.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5670 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7334c5aa
...@@ -62,6 +62,7 @@ active_threads = 0 ...@@ -62,6 +62,7 @@ active_threads = 0
max_active_threads = 1 # 2 will cause more bug to appear (he he) max_active_threads = 1 # 2 will cause more bug to appear (he he)
is_initialized = 0 is_initialized = 0
tic_lock = threading.Lock() # A RAM based lock tic_lock = threading.Lock() # A RAM based lock
first_run = 1
# Activity Registration # Activity Registration
activity_dict = {} activity_dict = {}
...@@ -467,7 +468,7 @@ class ActivityTool (Folder, UniqueObject): ...@@ -467,7 +468,7 @@ class ActivityTool (Folder, UniqueObject):
Starts again an activity Starts again an activity
processing_node starts from 1 (there is not node 0) processing_node starts from 1 (there is not node 0)
""" """
global active_threads, is_initialized global active_threads, is_initialized, first_run
# return if the number of threads is too high # return if the number of threads is too high
# else, increase the number of active_threads and continue # else, increase the number of active_threads and continue
...@@ -483,6 +484,13 @@ class ActivityTool (Folder, UniqueObject): ...@@ -483,6 +484,13 @@ class ActivityTool (Folder, UniqueObject):
# Initialize if needed # Initialize if needed
if not is_initialized: self.initialize() if not is_initialized: self.initialize()
# If this is the first tic after zope is started, reset the processing
# flag for activities of this node
if first_run:
self.SQLDict_clearProcessingFlag(processing_node=processing_node)
self.SQLQueue_clearProcessingFlag(processing_node=processing_node)
first_run = 0
try: try:
# Wakeup each queue # Wakeup each queue
for activity in activity_list: for activity in activity_list:
......
...@@ -7,10 +7,11 @@ cache_time:0 ...@@ -7,10 +7,11 @@ cache_time:0
class_name: class_name:
class_file: class_file:
</dtml-comment> </dtml-comment>
<params></params> <params>processing_node:int=-1</params>
UPDATE UPDATE
message message
SET SET
processing="0" processing="0"
WHERE WHERE
processing="1" processing="1"
AND processing_node="<dtml-sqlvar processing_node type="int">"
...@@ -7,10 +7,11 @@ cache_time:0 ...@@ -7,10 +7,11 @@ cache_time:0
class_name: class_name:
class_file: class_file:
</dtml-comment> </dtml-comment>
<params></params> <params>processing_node:int=-1</params>
UPDATE UPDATE
message_queue message_queue
SET SET
processing="0" processing="0"
WHERE WHERE
processing="1" processing="1"
AND processing_node="<dtml-sqlvar processing_node type="int">"
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