Browse Source

Fixed dead locks with SQLServer.

git-svn-id: http://svn.redmine.org/redmine/trunk@13844 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/3.0.0
Jean-Philippe Lang 9 years ago
parent
commit
a7378e450d
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      lib/redmine/nested_set/issue_nested_set.rb

+ 2
- 2
lib/redmine/nested_set/issue_nested_set.rb View File

@@ -153,8 +153,8 @@ module Redmine
if self.class.connection.adapter_name =~ /sqlserver/i
lock = "WITH (ROWLOCK HOLDLOCK UPDLOCK)"
end
sets_to_lock = [id, parent_id].compact
self.class.reorder(:id).where("root_id IN (SELECT root_id FROM #{self.class.table_name} WHERE id IN (?))", sets_to_lock).lock(lock).ids
sets_to_lock = [root_id, parent.try(:root_id)].compact.uniq
self.class.reorder(:id).where(:root_id => sets_to_lock).lock(lock).ids
end

def nested_set_scope

Loading…
Cancel
Save