From eb75efc1176a97a3eebd5b877f37d3ea98d35149 Mon Sep 17 00:00:00 2001 From: Alexandre Boeglin <alex@nexedi.com> Date: Thu, 9 Feb 2006 17:05:30 +0000 Subject: [PATCH] If zope was stopped while activities where processed we must mark them back as not being currently processed when starting zope, or they will be kept as zombies in the SQL tables, blokcing other activities using after_method_id. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5658 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/CMFActivity/Activity/SQLDict.py | 7 +++++++ product/CMFActivity/Activity/SQLQueue.py | 6 ++++++ .../activity/SQLDict_clearProcessingFlag.zsql | 16 ++++++++++++++++ .../activity/SQLQueue_clearProcessingFlag.zsql | 16 ++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100755 product/CMFActivity/skins/activity/SQLDict_clearProcessingFlag.zsql create mode 100755 product/CMFActivity/skins/activity/SQLQueue_clearProcessingFlag.zsql diff --git a/product/CMFActivity/Activity/SQLDict.py b/product/CMFActivity/Activity/SQLDict.py index e09a0e4994..a608a1a483 100755 --- a/product/CMFActivity/Activity/SQLDict.py +++ b/product/CMFActivity/Activity/SQLDict.py @@ -62,6 +62,13 @@ class SQLDict(RAMDict): and provide sequentiality. Should not create conflict because use of OOBTree. """ + def initialize(self, activity_tool): + if not self.is_initialized: + # If zope was stopped while activities where processed we must mark them + # as unprocessed, or they will be kept as zombies in the SQL table + activity_tool.SQLDict_clearProcessingFlag() + self.is_initialized = 1 + # Transaction commit methods def prepareQueueMessage(self, activity_tool, m): if m.is_registered: diff --git a/product/CMFActivity/Activity/SQLQueue.py b/product/CMFActivity/Activity/SQLQueue.py index 2261506bf7..baf89e4fc5 100755 --- a/product/CMFActivity/Activity/SQLQueue.py +++ b/product/CMFActivity/Activity/SQLQueue.py @@ -58,6 +58,12 @@ class SQLQueue(RAMQueue): and provide sequentiality. Should not create conflict because use of OOBTree. """ + def initialize(self, activity_tool): + if not self.is_initialized: + # If zope was stopped while activities where processed we must mark them + # as unprocessed, or they will be kept as zombies in the SQL table + activity_tool.SQLQueue_clearProcessingFlag() + self.is_initialized = 1 def prepareQueueMessage(self, activity_tool, m): if m.is_registered: diff --git a/product/CMFActivity/skins/activity/SQLDict_clearProcessingFlag.zsql b/product/CMFActivity/skins/activity/SQLDict_clearProcessingFlag.zsql new file mode 100755 index 0000000000..b65f1e9ac7 --- /dev/null +++ b/product/CMFActivity/skins/activity/SQLDict_clearProcessingFlag.zsql @@ -0,0 +1,16 @@ +<dtml-comment> +title: +connection_id:cmf_activity_sql_connection +max_rows:1000 +max_cache:100 +cache_time:0 +class_name: +class_file: +</dtml-comment> +<params></params> +UPDATE + message +SET + processing="0" +WHERE + processing="1" diff --git a/product/CMFActivity/skins/activity/SQLQueue_clearProcessingFlag.zsql b/product/CMFActivity/skins/activity/SQLQueue_clearProcessingFlag.zsql new file mode 100755 index 0000000000..6305f90705 --- /dev/null +++ b/product/CMFActivity/skins/activity/SQLQueue_clearProcessingFlag.zsql @@ -0,0 +1,16 @@ +<dtml-comment> +title: +connection_id:cmf_activity_sql_connection +max_rows:1000 +max_cache:100 +cache_time:0 +class_name: +class_file: +</dtml-comment> +<params></params> +UPDATE + message_queue +SET + processing="0" +WHERE + processing="1" -- 2.30.9