Actions
Patch #43607
closedOptimize Issue#recalculate_attributes_for to avoid unnecessary saves and cascading callbacks
Patch #43607:
Optimize Issue#recalculate_attributes_for to avoid unnecessary saves and cascading callbacks
Description
When a subtask is updated, Issue#recalculate_attributes_for recalculates derived attributes of its parent issue (such as priority, start_date,due_date, and done_ratio) and always saves the parent issue.
In cases where the recalculated values are identical to the existing ones, this still triggers save callbacks and recursive ancestor updates, resulting in unnecessary database queries. This becomes noticeable when the issue has a deep ancestor chain.
The attached patch changes the behavior to save the parent issue only when it has actual changes after recalculation. This preserves current behavior when values change, while avoiding needless callback chains and database queries when they do not.
Files
Actions