summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-07 20:57:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-07 20:57:52 +0000
commita7378e450d25a82394f80d219fb17f3d343230ea (patch)
treebabd791dd778e0963f589c95bd7c8be04f12c0fb /lib
parentded15dfc802dec165784949d75ce70987cf5e409 (diff)
downloadredmine-a7378e450d25a82394f80d219fb17f3d343230ea.tar.gz
redmine-a7378e450d25a82394f80d219fb17f3d343230ea.zip
Fixed dead locks with SQLServer.
git-svn-id: http://svn.redmine.org/redmine/trunk@13844 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/nested_set/issue_nested_set.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/redmine/nested_set/issue_nested_set.rb b/lib/redmine/nested_set/issue_nested_set.rb
index 5a6af9440..9d525293f 100644
--- a/lib/redmine/nested_set/issue_nested_set.rb
+++ b/lib/redmine/nested_set/issue_nested_set.rb
@@ -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