Reverts previously dropped commit that got reintroduced by a rebase.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 24 Aug 2020 15:48:53 +0000 (12:48 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 24 Aug 2020 15:48:53 +0000 (12:48 -0300)
Refs #16470

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

services/api/app/models/container_request.rb

index 16b4973216b230f3193e194527a66db709ab5c90..77536eee4f28f53a2acae66cc90d647967ff6b51 100644 (file)
@@ -123,10 +123,10 @@ class ContainerRequest < ArvadosModel
     while true
       # get container lock first, then lock current container request
       # (same order as Container#handle_completed). Locking always
-      # requires explicit Container and ContainerRequest records reload.
+      # reloads the Container and ContainerRequest records.
       c = Container.find_by_uuid(container_uuid)
-      c.reload.lock! if !c.nil?
-      self.reload.lock!
+      c.lock! if !c.nil?
+      self.lock!
 
       if !c.nil? && container_uuid != c.uuid
         # After locking, we've noticed a race, the container_uuid is
@@ -263,7 +263,7 @@ class ContainerRequest < ArvadosModel
     if state_changed? and state == Committed and container_uuid.nil?
       while true
         c = Container.resolve(self)
-        c.reload.lock!
+        c.lock!
         if c.state == Container::Cancelled
           # Lost a race, we have a lock on the container but the
           # container was cancelled in a different request, restart