Details
Description
When an ExecutionEntity is deleted, we check whether there are any TaskEntities/EventSubscriptions/Jobs
associated with this execution. if so, we remove them.
This leads to an increasingly large number of queries, which is most cases are pointless.
AT:
- at most one query is performed for entities (Jobs/Tasks/EventSubscriptions...) associated with an execution within a single command
------------
Idea (back from discussion with Tom): the parser could set properites like "isTaskUsed" or "isEventSubscriptionUsed" on the process definition / scope activity.
Based on such properties we should be able to reduce the number of queries.
Issue Links
- is related to
-
ACT-1134
Reduce number of compensate event subscription queries when a subprocess is completed
-
We should also cache Tasks and Jobs as a transient field (not persisted to DB) in the execution for the current command.
That same strategy is currently used for Process Variables and Compensate Event Subscriptions. The contract is that if you create / remove tasks or jobs, you also have to remove them from this transient list attached to the execution.
This will make sure that we only query at most once per command. As a side effect we obtain that if the process intance finishes in one single transaction, we do not have to perform any query at all.
This will a) greately improve performance and b) solve a couple of bugs where a timer is created in the same command in which it is removed (we currently leak a JobEntity in that situation)