17755: Merge branch 'main' into 17755-add-singularity-to-compute-image
[arvados.git] / services / api / lib / arvados_model_updates.rb
index b456bd39562adc4ff87a5c73a460c055344269b3..7f0d7c29092f51c1ac4d76b01aa6d4f62181de7f 100644 (file)
@@ -18,4 +18,21 @@ module ArvadosModelUpdates
       Thread.current[:anonymous_updater] = anonymous_updater_was
     end
   end
+
+  # ArvadosModel checks this to decide whether it should update the
+  # 'modified_at' field.
+  def timeless_updater
+    Thread.current[:timeless_updater] || false
+  end
+
+  def leave_modified_at_alone
+    timeless_updater_was = timeless_updater
+    begin
+      Thread.current[:timeless_updater] = true
+      yield
+    ensure
+      Thread.current[:timeless_updater] = timeless_updater_was
+    end
+  end
+
 end