[Erp5-report] r8166 - in /erp5/trunk/products/CMFActivity/Activity: SQLDict.py SQLQueue.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jun 26 14:36:30 CEST 2006


Author: yo
Date: Mon Jun 26 14:36:27 2006
New Revision: 8166

URL: http://svn.erp5.org?rev=8166&view=rev
Log:
If an exception but ConflictError happens when obtaining a message,
put the message into an error state immediately.

Modified:
    erp5/trunk/products/CMFActivity/Activity/SQLDict.py
    erp5/trunk/products/CMFActivity/Activity/SQLQueue.py

Modified: erp5/trunk/products/CMFActivity/Activity/SQLDict.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLDict.py?rev=8166&r1=8165&r2=8166&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLDict.py (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLDict.py Mon Jun 26 14:36:27 2006
@@ -291,13 +291,20 @@
 
           # Release locks before starting a potentially long calculation
           get_transaction().commit()
-      except:
-        # If an exception occurs, abort the transaction to minimize the impact,
+      except ConflictError:
+        # If a conflict occurs, abort the transaction to minimize the impact,
         # then simply delay the operations.
         get_transaction().abort()
         for uid_list in uid_list_list:
           activity_tool.SQLDict_setPriority(uid = uid_list, delay = VALIDATION_ERROR_DELAY,
                                             retry = 1)
+        get_transaction().commit()
+        return 0
+      except:
+        # For other exceptions, put the messages to an invalid state immediately.
+        get_transaction().abort()
+        for uid_list in uid_list_list:
+          activity_tool.SQLDict_assignMessage(uid = uid_list, processing_node = INVOKE_ERROR_STATE)
         get_transaction().commit()
         return 0
 

Modified: erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLQueue.py?rev=8166&r1=8165&r2=8166&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLQueue.py (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLQueue.py Mon Jun 26 14:36:27 2006
@@ -119,13 +119,20 @@
                                                 priority = line.priority)
             get_transaction().commit() # Release locks before starting a potentially long calculation
           return 0
-      except:
-        # If any exception occurs, catch it and delay the operation.
+      except ConflictError:
+        # If a conflict occurs, catch it and delay the operation.
         get_transaction().abort()
         activity_tool.SQLQueue_setPriority(uid = line.uid, date = next_processing_date,
                                            priority = line.priority)
         get_transaction().commit()
         return 0
+      except:
+        # For the other exceptions, put it into an error state.
+        get_transaction().abort()
+        activity_tool.SQLQueue_assignMessage(uid = line.uid, processing_node = INVOKE_ERROR_STATE)
+        get_transaction().commit()
+        return 0
+
 
       # Try to invoke
       activity_tool.invoke(m) # Try to invoke the message - what happens if read conflict error restarts transaction ?




More information about the Erp5-report mailing list