Patch #38820
closedRetry in case of stale issue during Issue.update_versions
Description
This is quite the corner case but we had this issue occur with one client at Planio:
With Setting.parent_issue_priority == 'derived'
, while setting a projects' parent project to nil, several issues that belonged to now inaccessible versions were updated in Issue.update_versions
. In one case, this led to a situation where an issues' parent issue priority was updated, before that parent issue was being processed in the loop in Issue.update_versions
. The attempt to then set the parent issues' version to nil
later failed with a StaleObjectError due to the previous save from Issue#update_parent_attributes
.
The attached patch against current master fixes that by catching the error and retrying once with a reloaded version of the issue. It also contains a test case that reproduces the issue (with MySQL, at least - the bug only shows when the child issue is processed before the parent in update_versions
, so it depends on the order in which issues are fetched there)
Files