X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2baac8a6702551064b065f752f75a9b40dbec0f5..f7029eca4ddc301167078827a6bed2219dd282a6:/services/api/app/models/container.rb?ds=sidebyside diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb index 8882b2c763..e9d4f83658 100644 --- a/services/api/app/models/container.rb +++ b/services/api/app/models/container.rb @@ -126,6 +126,7 @@ class Container < ArvadosModel # Update the priority of child container requests to match new # priority of the parent container (ignoring requests with no # container assigned, because their priority doesn't matter). + ActiveRecord::Base.connection.execute('LOCK container_requests, containers IN EXCLUSIVE MODE') ContainerRequest. where(requesting_container_uuid: self.uuid, state: ContainerRequest::Committed). @@ -541,6 +542,7 @@ class Container < ArvadosModel if self.state_changed? and self.final? act_as_system_user do + ActiveRecord::Base.connection.execute('LOCK container_requests, containers IN EXCLUSIVE MODE') if self.state == Cancelled retryable_requests = ContainerRequest.where("container_uuid = ? and priority > 0 and state = 'Committed' and container_count < container_count_max", uuid) else