Project

General

Profile

Actions

Patch #38820

closed

Retry in case of stale issue during Issue.update_versions

Added by Jens Krämer over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

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

Actions #1

Updated by Go MAEDA over 1 year ago

  • Target version set to Candidate for next major release
Actions #2

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.

Actions #3

Updated by Go MAEDA about 1 year ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch. Thank you.

Actions #4

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
Actions

Also available in: Atom PDF