X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f04211b1722e27037b305b58479157b5a492f30a..899891fe8a16934ab98b16456ea95d9f9c81587d:/app/models/way.rb diff --git a/app/models/way.rb b/app/models/way.rb index 34e568e4a..6d49735f1 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -199,7 +199,9 @@ class Way < ActiveRecord::Base new_nds = (nds - old_nodes).sort.uniq unless new_nds.empty? - db_nds = Node.where(:id => new_nds, :visible => true) + # NOTE: nodes are locked here to ensure they can't be deleted before + # the current transaction commits. + db_nds = Node.where(:id => new_nds, :visible => true).lock("for share") if db_nds.length < new_nds.length missing = new_nds - db_nds.collect(&:id)