mmd-osm left a comment (openstreetmap/openstreetmap-website#6379)

Here's the kind of change I've been testing locally. It moves both changeset 
consistency checking as well as DiffReader inside the exclusive changeset lock.

```ruby
diff --git a/app/controllers/api/changesets/uploads_controller.rb 
b/app/controllers/api/changesets/uploads_controller.rb
index ee9406d91..2afdd5e63 100644
--- a/app/controllers/api/changesets/uploads_controller.rb
+++ b/app/controllers/api/changesets/uploads_controller.rb
@@ -27,10 +27,10 @@ module Api
       # http://wiki.openstreetmap.org/wiki/OSM_Protocol_Version_0.6
       def create
         changeset = Changeset.find(params[:changeset_id])
-        check_changeset_consistency(changeset, current_user)
+        changeset.with_lock do
+          check_changeset_consistency(changeset, current_user)
 
-        diff_reader = DiffReader.new(request.raw_post, changeset)
-        Changeset.transaction do
+          diff_reader = DiffReader.new(request.raw_post, changeset)
           result = diff_reader.commit
           # the number of changes in this changeset has already been
           # updated and is visible in this transaction so we don't need
```



-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6379#issuecomment-3259467563
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/6379/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to