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
Updated by Go MAEDA over 1 year ago
- Target version set to Candidate for next major release
Updated by Go MAEDA about 1 year ago
- Target version changed from Candidate for next major release to 5.1.0
Setting the target version to 5.1.0.
Updated by Go MAEDA about 1 year ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
Committed the patch. Thank you.
Updated by Go MAEDA about 1 year ago
- Subject changed from retry in case of stale issue during Issue.update_versions to Retry in case of stale issue during Issue.update_versions