Commit 81a35e3d authored by Vincent Pelletier's avatar Vincent Pelletier

Do not call _beginAndHook if we are already registered to transaction manager.

This fixes a bug introduced by recent possibility to call interaction workflow methods in beforeCommitHooks.
  Example scenario of this bug:
    - create an activity
    - trigger an interaction workflow action set to happen before commit, and which creates an activity
    - commit transaction
  In beforeCommitHooks:
   - activity will get pushed to its queue
   - interaction will trigger, creating an activity, causing ActivityBuffer to register itself again.
   - both activities will get pushed to their queue (both the already-pushed one and the new one, since ActivityBuffer does its cleanup only at transaction commit).
  So we get 3 activities, where 2 were expected, and those numbers get worse very quickly (!n behaviour, n being the number of registered interactions).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24579 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7d178cdd
...@@ -69,6 +69,7 @@ class ActivityBuffer(TM): ...@@ -69,6 +69,7 @@ class ActivityBuffer(TM):
return buffer.uid_set_dict.setdefault(activity, set()) return buffer.uid_set_dict.setdefault(activity, set())
def _register(self, activity_tool): def _register(self, activity_tool):
if not self._registered:
self._beginAndHook(activity_tool) self._beginAndHook(activity_tool)
TM._register(self) TM._register(self)
......
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