16470: Fixes tests. Avoids closing a DB connection when using threads on tests.
[arvados.git] / services / api / app / models / collection.rb
index caac5611e79c8baa43d30e396b33cc4a92f9d146..996981dba798c03559bb914b54daf0e8725f57a0 100644 (file)
@@ -259,9 +259,10 @@ class Collection < ArvadosModel
     should_preserve_version = should_preserve_version? # Time sensitive, cache value
     return(yield) unless (should_preserve_version || syncable_updates.any?)
 
-    # Put aside the changes because with_lock forces a record reload
+    # Put aside the changes because with_lock requires an explicit record reload
     changes = self.changes
     snapshot = nil
+    reload
     with_lock do
       # Copy the original state to save it as old version
       if should_preserve_version