summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-08-23 07:40:25 +0000
committerGo MAEDA <maeda@farend.jp>2023-08-23 07:40:25 +0000
commit86c5d7814f4c3e860e449cdda05717984ca21405 (patch)
tree7fe0365f7b5aa4025810c0d7ee18c8aef26605e9 /app
parent679ba509da39fa1537db9e5c0321d280cb44ad52 (diff)
downloadredmine-86c5d7814f4c3e860e449cdda05717984ca21405.tar.gz
redmine-86c5d7814f4c3e860e449cdda05717984ca21405.zip
Retry in case of stale issue during Issue.update_versions (#38820).
Patch by Jens Krämer. git-svn-id: https://svn.redmine.org/redmine/trunk@22279 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/issue.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index e23b02647..8e131118c 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -1891,9 +1891,18 @@ class Issue < ActiveRecord::Base
next if issue.project.nil? || issue.fixed_version.nil?
unless issue.project.shared_versions.include?(issue.fixed_version)
- issue.init_journal(User.current)
- issue.fixed_version = nil
- issue.save
+ retried = false
+ begin
+ issue.init_journal(User.current)
+ issue.fixed_version = nil
+ issue.save
+ rescue ActiveRecord::StaleObjectError
+ raise if retried
+
+ retried = true
+ issue.reload
+ retry
+ end
end
end
end