[ARVADOS] updated: 1.3.0-2834-g571e9ea46
Git user
git at public.arvados.org
Fri Jul 24 20:15:07 UTC 2020
Summary of changes:
services/api/app/models/container_request.rb | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
via 571e9ea468feaa22ccf56b9585a36d6d84f1b8bd (commit)
from 070bcb4e6afda609a371a5bfc7d0927f379e4531 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 571e9ea468feaa22ccf56b9585a36d6d84f1b8bd
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Fri Jul 24 17:12:27 2020 -0300
16470: Fixes the last deprecation warnings.
It turned out that .lock!() is an ActiveRecord method, and I was confusing it
with Container::lock and ContainerRequest::lock.
Both lock! and with_lock methods need the record to be persisted or reloaded
explicitly.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 77536eee4..16b497321 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -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
- # reloads the Container and ContainerRequest records.
+ # requires explicit Container and ContainerRequest records reload.
c = Container.find_by_uuid(container_uuid)
- c.lock! if !c.nil?
- self.lock!
+ c.reload.lock! if !c.nil?
+ self.reload.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.lock!
+ c.reload.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
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list